Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jun 13, 2010, 12:41 AM   #1
Aayush
macrumors newbie
 
Join Date: Nov 2008
Location: Siliguri, W.B., India
Send a message via AIM to Aayush Send a message via Yahoo to Aayush Send a message via Skype™ to Aayush
‘presentModalViewController:setAnimated:’ is throwing an exception.

Hello.

I’m trying to get the ‘Add’ button on my navigation bar in the RootViewController of my navigation-based iPhone application to bring up a modal view controller. All I’ve done so far in the program is what I’ve listed below.

I created a navigation-based app, uncommented the ‘viewDidLoad:’ method and added the following lines to it:

Code:
	UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(addSimpleTest)];
	self.navigationItem.rightBarButtonItem = addButton;
	[addButton release];
I then hit ⌘N, chose ‘UIViewController subclass’ as the type of file and enabled “With XIB for user interface”. I named it ‘SimpleTest.m’ and enabled “Also create SimpleTest.h”. Then I went back to ‘RootViewController.h’ and added the following method declaration:

Code:
- (void)addSimpleTest;
In the corresponding implementation file, I wrote the following code for that method:

Code:
- (void)addSimpleTest
{
	SimpleTest *simpleTest = [[SimpleTest alloc] initWithNibName:@"SimpleTest.xib" bundle:nil];
	[self presentModalViewController:simpleTest animated:YES];
	[simpleTest release];	
}
And that’s it. That’s all I’ve done. It ought to work, right? When I run the program and tap on the ‘Add’ button, it crashes and throws the following exception:

Code:
2010-06-13 10:51:50.617 Testing[24725:207] *** -[NSKeyedUnarchiver initForReadingWithData:]: data is NULL
2010-06-13 10:51:50.621 Testing[24725:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '(null)'
I’ve tried to use the debugger to figure out what is wrong and all I’ve managed to ascertain is that the crash happens when calling the ‘presentModalViewController:setAnimated:’ method and, for the life of me, I just cannot figure out what is wrong.

I’m using Xcode version 3.2.3 (pre-release) 64-bit. The Xcode IDE version is 1680.0. The iPhone Simulator is at version 4.0 (204) and I’m running Mac OS X version 10.6.3.

If anyone could lend me a helping hand here, I would really appreciate it. Thank you.
Aayush is offline   0 Reply With Quote
Old Jun 13, 2010, 03:22 AM   #2
Aayush
Thread Starter
macrumors newbie
 
Join Date: Nov 2008
Location: Siliguri, W.B., India
Send a message via AIM to Aayush Send a message via Yahoo to Aayush Send a message via Skype™ to Aayush
Never mind. The problem was that the NIB name should not contain the “.XIB” extension. It’s working now.
Aayush is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Would I be an exception to an expired extended warranty replacement program? c0bracommander iMac 3 Mar 1, 2010 04:09 AM
About an exception iphonejudy iPhone/iPad Programming 1 Aug 11, 2009 09:41 AM
XCode - how to "see" an exception that is thrown GregX999 Mac Programming 4 Apr 11, 2009 12:13 PM
WebObjects throwing inappropriate exceptions in multi-component apps GeeYouEye Mac Applications and Mac App Store 0 Apr 17, 2005 02:13 AM
An Exceptional Apple Store Experience! IJ Reilly General Mac Discussion 11 Apr 14, 2005 06:00 PM


All times are GMT -5. The time now is 09:47 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Privacy / DMCA contact / Affiliate and FTC Disclosure
Copyright 2002-2013, MacRumors.com, LLC