0

私のアプリケーションは正常に起動し、エラーはありませんが、ボタンをクリックして別のビューを表示しようとすると、アプリケーションが終了します。デバッガコンソールで
、これはディスプレイであり、ボタンからサブビューを呼び出す:アプリケーションが閉じる

"SEM2REDO[13487:b603] Application tried to push a nil view controller on target <UINavigationController: 0x4ea5be0>" 

その後、あなたはそれをクリックして二回目は、これが表示され、アプリケーションが解除されます。

2012-01-24 11:46:37.549 SEM2REDO[13591:b603] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/margueriteoquinn/Library/Application Support/iPhone Simulator/4.3/Applications/F2B86CC5-C700-414E-9030-17E94535EB1A/SEM2REDO.app> (loaded)' with name 'SelectView'' 
*** Call stack at first throw: 
(
    0 CoreFoundation      0x00dc95a9 __exceptionPreprocess + 185 
    1 libobjc.A.dylib      0x00f1d313 objc_exception_throw + 44 
    2 CoreFoundation      0x00d81ef8 +[NSException raise:format:arguments:] + 136 
    3 CoreFoundation      0x00d81e6a +[NSException raise:format:] + 58 
    4 UIKit        0x004b40fa -[UINib instantiateWithOwner:options:] + 2024 
    5 UIKit        0x004b5ab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168 
    6 UIKit        0x0036b628 -[UIViewController _loadViewFromNibNamed:bundle:] + 70 
    7 UIKit        0x00369134 -[UIViewController loadView] + 120 
    8 UIKit        0x0036900e -[UIViewController view] + 56 
    9 UIKit        0x00367482 -[UIViewController contentScrollView] + 42 
    10 UIKit        0x00377f25 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48 
    11 UIKit        0x00376555 -[UINavigationController _layoutViewController:] + 43 
    12 UIKit        0x00377870 -[UINavigationController _startTransition:fromViewController:toViewController:] + 524 
    13 UIKit        0x0037232a -[UINavigationController _startDeferredTransitionIfNeeded] + 266 
    14 UIKit        0x00379562 -[UINavigationController pushViewController:transition:forceImmediate:] + 932 
    15 UIKit        0x003721c4 -[UINavigationController pushViewController:animated:] + 62 
    16 SEM2REDO       0x00002590 -[SEM2REDOViewController chooseFirstMeeting:] + 252 
    17 UIKit        0x002b94fd -[UIApplication sendAction:to:from:forEvent:] + 119 
    18 UIKit        0x00349799 -[UIControl sendAction:to:forEvent:] + 67 
    19 UIKit        0x0034bc2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527 
    20 UIKit        0x0034a7d8 -[UIControl touchesEnded:withEvent:] + 458 
    21 UIKit        0x002ddded -[UIWindow _sendTouchesForEvent:] + 567 
    22 UIKit        0x002bec37 -[UIApplication sendEvent:] + 447 
    23 UIKit        0x002c3f2e _UIApplicationHandleEvent + 7576 
    24 GraphicsServices     0x01721992 PurpleEventCallback + 1550 
    25 CoreFoundation      0x00daa944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52 
    26 CoreFoundation      0x00d0acf7 __CFRunLoopDoSource1 + 215 
    27 CoreFoundation      0x00d07f83 __CFRunLoopRun + 979 
    28 CoreFoundation      0x00d07840 CFRunLoopRunSpecific + 208 
    29 CoreFoundation      0x00d07761 CFRunLoopRunInMode + 97 
    30 GraphicsServices     0x017201c4 GSEventRunModal + 217 
    31 GraphicsServices     0x01720289 GSEventRun + 115 
    32 UIKit        0x002c7c93 UIApplicationMain + 1160 
    33 SEM2REDO       0x00001a70 main + 102 
    34 SEM2REDO       0x00001a01 start + 53 
) 
terminate called throwing an exception 

私はこれが何を意味するのかわかりませんが、私は実際にいくつかの助けを必要としています。ここで私は

@synthesize window; 
@synthesize navController; 


#pragma mark - 
#pragma mark Application lifecycle 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {  
    [self.window makeKeyAndVisible]; 

    SEM2REDOViewController *firstController = [[SEM2REDOViewController alloc] 
              initWithNibName:@"SEM2REDOViewController" bundle:nil]; 
    UINavigationController *navigationController = [[UINavigationController alloc] 
               initWithRootViewController:firstController]; 

    [self setNavController:navigationController]; 
    [window addSubview:[navigationController view]]; 

    [navigationController release]; 
    [firstController release]; 

    return YES; 

}

実装されているいくつかの有用なデリゲートメソッドがあり、これはごめんなさい

- (IBAction)chooseFirstMeeting:(id)sender {  
    SelectRotationController *selectView = [[SelectRotationController alloc] 
              initWithNibName:@"SelectView" bundle:[NSBundle mainBundle]]; 
    [selectView.navigationItem setTitle:@"Select First Meeting"]; 
    [self.navigationController pushViewController:self.selectRotationController animated:YES]; 
    self.selectRotationController = selectView; 
    [selectView release]; 
} 

はこれがある場合は、2番目のビューを表示するために私SEM2REDOViewController方法であります簡単な質問:私は高校生でプログラミングに関する独立した研究をしようとしているので、どんな助けでも大歓迎です。

+0

コードの2番目のブロックは、最初のコードブロックと同じです。あなたはそれを編集しますか?また、コードの書式設定を使用する - コードを強調表示し、フォームの上部にある中括弧を選択するだけです。 – Jim

+0

ありがとうございました。 – mentorship

答えて

0
[self.window makeKeyAndVisible]; 

SEM2REDOViewController *firstController = [[SEM2REDOViewController alloc] initWithNibName:@"SEM2REDOViewController" bundle:nil]; UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:firstController]; 

[self setNavController:navigationController]; 
[window addSubview:[navigationController view]]; 

[navigationController release]; [firstController release]; 

return YES; 

これは、あなたが私に教えて何かを理解するあらゆる問題を抱えているあなたのissue..ifを解決行います

SEM2REDOViewController *firstController = [[[SEM2REDOViewController alloc] initWithNibName:@"SEM2REDOViewController" bundle:nil] autorelease]; 
self.navigationController = [[[UINavigationController alloc]initWithRootViewController: firstController]autorelease]; 

[window addSubview:self.navigationController.view]; 

[self.window makeKeyAndVisible]; 
return YES; 

に変更し、それを。

+0

行を変更してみてください[window addSubview .... to self.window.rootViewController = self.navigationController; – Shubhank

+0

あなたのコードをブレークポイントしてみてください。どのラインが正常に通過し、どのラインがクラッシュするのかをチェックします。 – Shubhank

+0

それはそれがブレークポイントの下で言われたすべてだった...私はそれが何を意味するのか分からない。 – mentorship

0

ナビゲーションコントローラを解放してから、そのコントローラにビューコントローラを追加しようとしているようです。

関連する問題