我正在iOS Static Library
工作的每个人。当我在示例应用程序中使用此静态库并运行它时,它会崩溃并出现以下异常...
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/name/Library/Developer/CoreSimulator/Devices/D982246E-72D6-482F-8E1C-AE3D1BF37607/data/Containers/Bundle/Application/016193F2-36A3-492D-8E7B-CE560FACCF6D/TestApp.app> (loaded)' with name 'OptionsViewController''
*** First throw call stack:
(
0 CoreFoundation 0x0000000107385c65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010701ebb7 objc_exception_throw + 45
2 CoreFoundation 0x0000000107385b9d +[NSException raise:format:] + 205
3 UIKit 0x0000000107d30171 -[UINib instantiateWithOwner:options:] + 552
4 UIKit 0x0000000107b88718 -[UIViewController _loadViewFromNibNamed:bundle:] + 242
5 UIKit 0x0000000107b88d08 -[UIViewController loadView] + 109
6 UIKit 0x0000000107b88f79 -[UIViewController loadViewIfRequired] + 75
7 UIKit 0x0000000107b8940e -[UIViewController view] + 27
8 UIKit 0x0000000107bae297 -[UINavigationController _startCustomTransition:] + 633
9 UIKit 0x0000000107bba3bf -[UINavigationController _startDeferredTransitionIfNeeded:] + 386
10 UIKit 0x0000000107bbaf0e -[UINavigationController __viewWillLayoutSubviews] + 43
11 UIKit 0x0000000107d05715 -[UILayoutContainerView layoutSubviews] + 202
12 UIKit 0x0000000107ad8a2b -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 536
13 QuartzCore 0x000000010bcbeec2 -[CALayer layoutSublayers] + 146
14 QuartzCore 0x000000010bcb36d6 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
15 QuartzCore 0x000000010bcb3546 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
16 QuartzCore 0x000000010bc1f886 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 242
17 QuartzCore 0x000000010bc20a3a _ZN2CA11Transaction6commitEv + 462
18 QuartzCore 0x000000010bc210eb _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 89
19 CoreFoundation 0x00000001072b8ca7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
20 CoreFoundation 0x00000001072b8c00 __CFRunLoopDoObservers + 368
21 CoreFoundation 0x00000001072aea33 __CFRunLoopRun + 1123
22 CoreFoundation 0x00000001072ae366 CFRunLoopRunSpecific + 470
23 GraphicsServices 0x000000010b7e7a3e GSEventRunModal + 161
24 UIKit 0x0000000107a58900 UIApplicationMain + 1282
25 TestApp 0x0000000106a54bcf main + 111
26 libdyld.dylib 0x0000000109b7f145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
我知道,通常这个错误意味着OptionsViewController
xib文件没有被包含在这个库/项目中,但猜猜是什么? OptionsViewController's
以及.m
和compile Sources
文件中的.h
.xib
文件存在于Build Phases
库的副本文件中。
此库是Xcode 6.1
的工作文件。我安装Xcode 6.3
的时间。这次崩溃进入了画面,现在即使在Xcode 6.1
现在我很无知为什么我的示例应用程序会继续崩溃。已经整整一天,我一直在努力解决这个问题而没有任何运气。
任何指导,线索,任何都将受到高度赞赏。
更新
应用程序无法从静态库中找到资源,文件和任何内容。
我必须包含所有.h
,.xibs
和resources
文件,以构建示例应用的面部以使其正常工作,这不是我认为的正确方法。
答案 0 :(得分:1)
请尝试使用[[OptionsViewController alloc] initWithNibName:@"OptionsViewController" bundle:[NSBundle bundleForClass:[OptionsViewController class]]];
。