0

私はもともと iOS 6 用に作成したアプリを持っていますが、今は iOS 7 で動作させたいと考えています。プロジェクトを Xcode 5 で開き、いくつかのものを編集しました。の行に沿ったエラーメッセージを除いて、正常に機能しましたNeed a root view controller before launch(正確な言葉遣いは覚えていません)。rootViewController が設定されていて、アプリがまだ正常に動作していたため、これは奇妙に思えました。[self.window makeKeyAndVisible]その後、さらに編集したところ、行が呼び出されたときに次のエラー メッセージが表示されました。

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(
0   CoreFoundation                      0x01f155e4 __exceptionPreprocess + 180
1   libobjc.A.dylib                     0x01b058b6 objc_exception_throw + 44
2   CoreFoundation                      0x01ec7c3c -[__NSArrayM insertObject:atIndex:] + 844
3   CoreFoundation                      0x01ec78e0 -[__NSArrayM addObject:] + 64
4   Nobles                              0x00003efd -[AppDelegate addReachabilityDisabledButton:] + 109
5   Nobles                              0x00014f4c -[FoodViewController viewDidLoad] + 188
6   UIKit                               0x0077e9a8 -[UIViewController loadViewIfRequired] + 696
7   UIKit                               0x0077ec44 -[UIViewController view] + 35
8   Nobles                              0x000129fa -[MenuViewController viewDidLoad] + 1322
9   UIKit                               0x0077e9a8 -[UIViewController loadViewIfRequired] + 696
10  UIKit                               0x0077ec44 -[UIViewController view] + 35
11  UIKit                               0x006a75ad -[UIWindow addRootViewControllerViewIfPossible] + 66
12  UIKit                               0x006a7947 -[UIWindow _setHidden:forced:] + 312
13  UIKit                               0x006a7bdd -[UIWindow _orderFrontWithoutMakingKey] + 49
14  UIKit                               0x006b244a -[UIWindow makeKeyAndVisible] + 65
15  Nobles                              0x000036b2 -[AppDelegate application:didFinishLaunchingWithOptions:] + 2642
16  UIKit                               0x00664f65 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 309
17  UIKit                               0x006657a5 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1536
18  UIKit                               0x00669fb8 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824
19  UIKit                               0x0067e42c -[UIApplication handleEvent:withNewEvent:] + 3447
20  UIKit                               0x0067e999 -[UIApplication sendEvent:] + 85
21  UIKit                               0x0066bc35 _UIApplicationHandleEvent + 736
22  GraphicsServices                    0x034912eb _PurpleEventCallback + 776
23  GraphicsServices                    0x03490df6 PurpleEventCallback + 46
24  CoreFoundation                      0x01e90dd5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
25  CoreFoundation                      0x01e90b0b __CFRunLoopDoSource1 + 523
26  CoreFoundation                      0x01ebb7ec __CFRunLoopRun + 2156
27  CoreFoundation                      0x01ebab33 CFRunLoopRunSpecific + 467
28  CoreFoundation                      0x01eba94b CFRunLoopRunInMode + 123
29  UIKit                               0x006696ed -[UIApplication _run] + 840
30  UIKit                               0x0066b94b UIApplicationMain + 1225
31  Nobles                              0x00002c2d main + 141
32  libdyld.dylib                       0x0317f725 start + 0
)
libc++abi.dylib: terminating with uncaught exception of type NSException

この行 if を呼び出す前に rootViewController が nil かどうかを確認しましたが、そうではありませんでした。このエラーが発生する前に AppDelegate を変更しませんでした。

何か案は?

前もって感謝します。

4

1 に答える 1

1

It looks like the issue is in -[AppDelegate addReachabilityDisabledButton:] This function is getting called from -[FoodViewController viewDidLoad]. I'm assuming a button is being passed in that is nil. Check the xib for FoodViewController, to make sure the outlet is set. The new format for xibs has occasionally posed problems for me, so it may just require opening the file, checking the outlet and saving.

If that doesn't work set a breakpoint at [FoodViewController viewDidLoad] and try to inspect the value for the object that is being passed in.

于 2013-09-19T19:29:37.753 に答える