Error during Navigation point

2

I have created one navigation based application. In that first view show me the list of the drinks and in second view it show me the Details of the Drinks. All seems ok but while i am navigatting the view at (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath Method, It will show me the error like

terminate called after throwing an instance of 'NSException'

at line

 [self.navigationController pushViewController:drinkDetailViewController animated:YES];

Plese help me, why it happens like that ?

My code for the method is as follow:

(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

    DrinkDetailViewController *drinkDetailViewController = [[DrinkDetailViewController alloc] initWithNibName:@"DrinkDetailViewController" bundle:nil];
    //UINavigationController *navCon = [[UINavigationController alloc] initWithRootViewController:drinkDetailViewController];

    //[self presentModalViewController:drinkDetailViewController animated:YES];

    //[self dismissModalViewControllerAnimated:YES];

    // ...
    // Pass the selected object to the new view controller.
    [self.navigationController pushViewController:drinkDetailViewController animated:YES];

    [drinkDetailViewController release];

}

While i click on row, it shows me that exception message. This is project log:

2011-08-10 10:18:10.559 DrinkMixer_Shreyash[694:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "DrinkDetailViewController" nib but the view outlet was not set.'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x00dc25a9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x00f16313 objc_exception_throw + 44
    2   CoreFoundation                      0x00d7aef8 +[NSException raise:format:arguments:] + 136
    3   CoreFoundation                      0x00d7ae6a +[NSException raise:format:] + 58
    4   UIKit                               0x000c6709 -[UIViewController _loadViewFromNibNamed:bundle:] + 295
    5   UIKit                               0x000c4134 -[UIViewController loadView] + 120
    6   UIKit                               0x000c400e -[UIViewController view] + 56
    7   UIKit                               0x000c2482 -[UIViewController contentScrollView] + 42
    8   UIKit                               0x000d2f25 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48
    9   UIKit                               0x000d1555 -[UINavigationController _layoutViewController:] + 43
    10  UIKit                               0x000d27aa -[UINavigationController _startTransition:fromViewController:toViewController:] + 326
    11  UIKit                               0x000cd32a -[UINavigationController _startDeferredTransitionIfNeeded] + 266
    12  UIKit                               0x000d4562 -[UINavigationController pushViewController:transition:forceImmediate:] + 932
    13  UIKit                               0x000cd1c4 -[UINavigationController pushViewController:animated:] + 62
    14  DrinkMixer_Shreyash                 0x000029bf -[RootViewController tableView:didSelectRowAtIndexPath:] + 191
    15  UIKit                               0x0008bb68 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1140
    16  UIKit                               0x00081b05 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 219
    17  Foundation                          0x0079b79e __NSFireDelayedPerform + 441
    18  CoreFoundation                      0x00da38c3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
    19  CoreFoundation                      0x00da4e74 __CFRunLoopDoTimer + 1220
    20  CoreFoundation                      0x00d012c9 __CFRunLoopRun + 1817
    21  CoreFoundation                      0x00d00840 CFRunLoopRunSpecific + 208
    22  CoreFoundation                      0x00d00761 CFRunLoopRunInMode + 97
    23  GraphicsServices                    0x00ffa1c4 GSEventRunModal + 217
    24  GraphicsServices                    0x00ffa289 GSEventRun + 115
    25  UIKit                               0x00022c93 UIApplicationMain + 1160
    26  DrinkMixer_Shreyash                 0x00002089 main + 121
    27  DrinkMixer_Shreyash                 0x00002005 start + 53
    28  ???                                 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
sharedlibrary apply-load-rules all
Current language:  auto; currently objective-c
(gdb) 

Please help me regarding it. . .

iphone
ios4
iphone-sdk-3.0
cocos2d-iphone
ios-simulator
asked on Stack Overflow Aug 10, 2011 by Shreyash Mahajan • edited Aug 10, 2011 by omz

2 Answers

3

iDroid Exploer , in your drinkDetailViewController class you have to connect the view variable to the view element of the Xib file. It has to be done via interface builder.

answered on Stack Overflow Aug 10, 2011 by Praveen S
2

This is the crash regarding that your IBOutlet for View in DrinkDetailViewController is not set in XIB file. Please set Your View in XIB and then try to run the app. This is done using Interface builder..

Happy Coding...

answered on Stack Overflow Aug 10, 2011 by Mehul Mistri

User contributions licensed under CC BY-SA 3.0