0上的应用程序崩溃

0上的应用程序崩溃

本文介绍了加载主XIB使iOS 3.0上的应用程序崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谢谢你花一点时间阅读我的问题。
我有这个应用程序(在Cydia),其中约10%的用户使用iOS 3.0,所以我想在下次更新中支持他们。



我使用运行的iOS 4.0和5.0.1的实际设备进行了测试;它工作正常但是在iOS 3.0中,它崩溃了一个例外:

 由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:' -  [NSKeyedUnarchiver initForReadingWithData:]:不可理解的归档(0x4e,0x49,0x42,0x41,0x72,0x63,0x68,0x69)

显然当加载主XIB时,这是异常的回溯:

  0 objc_exception_throw()中的0x30016588 
1 0x30224026 in + [NSException raise:format:arguments:]()
2 0x30223fc6 in + [NSException raise:format:]()
3 0x305564b4 in - [NSKeyedUnarchiver initForReadingWithData:]()
4 0x3094927c in - [UINib instantiateWithOptions:owner:loadingResourcesFromBundle:]()
5 0x30949090 in - [NSBundle(NSBundleAdditions)loadNibNamed:owner:options:]()
6 0x308f131c in - [UIApplication _loadMainNibFile] ()
7 0x308f0f9c in - [UIApplication _runWithURL:sourceBundleID:]()
8 0x309374b0 in - [UIApplication handleEve nT:withNewEvent:]()
9 0x30936cf0 in - [UIApplication sendEvent:]()
10 0x3093687c在_UIApplicationHandleEvent()
11 0x3204696c在PurpleEventCallback()
12 0x30254a76在CFRunLoopRunSpecific ()
13 0x3025416a在CFRunLoopRunInMode()
14 0x308f0354 in - [UIApplication _run]()
15 0x308eea94在UIApplicationMain()
16 0x00003886在main(argc = 1,argv = 0x2ffff74c)

我已阅读并尝试和。所以我的所有nibs的部署版本设置为3.0,并开发到Interface Builder 3.0,仍然没有运气。

解决方案

之后阅读一些文档,很明显,iOS之前的3.2将不会从Xcode 4.2加载NIB,所以我最终用Xcode 3.2构建项目,并将这些NIB复制到使用Xcode 4.2在DerivedData目录下创建的包,最重要的是我仍然可以用Xcode 4.2调试应用程序,坏的部分是,这有点黑客,但我没有选择。谢谢。


thank you for taking some time to read my question.I have this app (In Cydia), which has around 10% of users with iOS 3.0, so I want to support them in my next update .

I tested it with actual devices running, iOS 4.0 and 5.0.1; it worked fine. But on iOS 3.0 it crashes with an exception:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' -[NSKeyedUnarchiver initForReadingWithData:]: incomprehensible archive (0x4e, 0x49, 0x42, 0x41, 0x72, 0x63, 0x68, 0x69)

apparently when loading the main XIB, here's the backtrace of the exception:

0  0x30016588 in objc_exception_throw ()
1  0x30224026 in +[NSException raise:format:arguments:] ()
2  0x30223fc6 in +[NSException raise:format:] ()
3  0x305564b4 in -[NSKeyedUnarchiver initForReadingWithData:] ()
4  0x3094927c in -[UINib instantiateWithOptions:owner:loadingResourcesFromBundle:] ()
5  0x30949090 in -[NSBundle(NSBundleAdditions) loadNibNamed:owner:options:] ()
6  0x308f131c in -[UIApplication _loadMainNibFile] ()
7  0x308f0f9c in -[UIApplication _runWithURL:sourceBundleID:] ()
8  0x309374b0 in -[UIApplication handleEvent:withNewEvent:] ()
9  0x30936cf0 in -[UIApplication sendEvent:] ()
10 0x3093687c in _UIApplicationHandleEvent ()
11 0x3204696c in PurpleEventCallback ()
12 0x30254a76 in CFRunLoopRunSpecific ()
13 0x3025416a in CFRunLoopRunInMode ()
14 0x308f0354 in -[UIApplication _run] ()
15 0x308eea94 in UIApplicationMain ()
16 0x00003886 in main (argc=1, argv=0x2ffff74c)

I've read and tried this and this. So I have all of my nibs with deployment version set to 3.0 and development to Interface Builder 3.0, still no luck.

解决方案

After reading some docs, it became clear that iOS prior 3.2 won't load NIBs from Xcode 4.2, so I ended up building the project with Xcode 3.2 and copied these NIBs to the package created with Xcode 4.2 under the DerivedData directory, the good part is I still can debug the app with Xcode 4.2, the bad part is, this is kinda hacky, but I hadn't choice. Thank you.

这篇关于加载主XIB使iOS 3.0上的应用程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 06:18