Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development > iPhone SDK Development - Advanced Discussion

Reply
 
LinkBack Thread Tools Display Modes
Old 09-16-2011, 10:01 PM   #1 (permalink)
ppn
Registered Member
 
Join Date: Oct 2010
Posts: 45
ppn is on a distinguished road
Default NSInternalInconsistencyException

I'm in the process of converting my iphone app into ipad app. I use a presentModalViewController to open up the next view. It works on my iphone but I get the following error at the [self presentModalViewController:resultsViewController animated:YES]; when I use it on the ipad 4.3 simulator version:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "ResultsViewController" nib but the view outlet was not set.

When I run it on the ipad 5.0 simulator version I only get a "Program received signal: SIGABRT" but I don't get he above error. I'm using the new xcode 4.2 and I find it weird I'm getting 2 different error results depending on which simulator I run it on. Does anyone know if the presentModalViewController works on ipad?

Here's my method:

Code:
-(IBAction)viewResults:(id)sender{
	[self stopRepeatingTimer:self];
	[self saveQuizTime];
	[self saveResult];
	NSString *tempTime;
	if (totalTimerCount < 3600) {
		tempTime = [[NSString alloc] initWithFormat:@"%02i:%02i", totalTimerCount/60, totalTimerCount%60];
	} else {
		tempTime = [[NSString alloc] initWithFormat:@"%02i:%02i:%02i", totalTimerCount/3600, (totalTimerCount%3600)/60, (totalTimerCount%3600)%60];
	}
	ResultsViewController *resultsViewController = [[ResultsViewController alloc] initWithNibName:@"ResultsViewController" bundle:nil];
	resultsViewController.quizid = self.quizid;
	resultsViewController.dateTaken = [NSDate date];
	resultsViewController.timeString = tempTime;
	resultsViewController.correctCounter = self.correctCounter;
	resultsViewController.totalQuestions = totalQuizQuestions;
	resultsViewController.quizSummary = self.quizSummary;
	resultsViewController.parentView = @"Quiz";
    resultsViewController.delegate = self;
    resultsViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
    [self presentModalViewController:resultsViewController animated:YES];
	[resultsViewController release];
	[tempTime release];
}
ppn is offline   Reply With Quote
Old 09-18-2011, 04:44 PM   #2 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,002
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by ppn View Post
I'm in the process of converting my iphone app into ipad app. I use a presentModalViewController to open up the next view. It works on my iphone but I get the following error at the [self presentModalViewController:resultsViewController animated:YES]; when I use it on the ipad 4.3 simulator version:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "ResultsViewController" nib but the view outlet was not set.

When I run it on the ipad 5.0 simulator version I only get a "Program received signal: SIGABRT" but I don't get he above error. I'm using the new xcode 4.2 and I find it weird I'm getting 2 different error results depending on which simulator I run it on. Does anyone know if the presentModalViewController works on ipad?

Here's my method:

Code:
-(IBAction)viewResults:(id)sender{
	[self stopRepeatingTimer:self];
	[self saveQuizTime];
	[self saveResult];
	NSString *tempTime;
	if (totalTimerCount < 3600) {
		tempTime = [[NSString alloc] initWithFormat:@"%02i:%02i", totalTimerCount/60, totalTimerCount%60];
	} else {
		tempTime = [[NSString alloc] initWithFormat:@"%02i:%02i:%02i", totalTimerCount/3600, (totalTimerCount%3600)/60, (totalTimerCount%3600)%60];
	}
	ResultsViewController *resultsViewController = [[ResultsViewController alloc] initWithNibName:@"ResultsViewController" bundle:nil];
	resultsViewController.quizid = self.quizid;
	resultsViewController.dateTaken = [NSDate date];
	resultsViewController.timeString = tempTime;
	resultsViewController.correctCounter = self.correctCounter;
	resultsViewController.totalQuestions = totalQuizQuestions;
	resultsViewController.quizSummary = self.quizSummary;
	resultsViewController.parentView = @"Quiz";
    resultsViewController.delegate = self;
    resultsViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
    [self presentModalViewController:resultsViewController animated:YES];
	[resultsViewController release];
	[tempTime release];
}
Yes, of course presentModalViewController:animated: works on iPad.

The error is telling you exactly what is wrong. The nibfile for the iPad version of your view controller does not have the main view connected to the view controller's view property. It's an easy mistake to make, and also an easy thing to fix.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 09-18-2011, 06:01 PM   #3 (permalink)
ppn
Registered Member
 
Join Date: Oct 2010
Posts: 45
ppn is on a distinguished road
Default

Quote:
Originally Posted by Duncan C View Post
Yes, of course presentModalViewController:animated: works on iPad.

The error is telling you exactly what is wrong. The nibfile for the iPad version of your view controller does not have the main view connected to the view controller's view property. It's an easy mistake to make, and also an easy thing to fix.
Ok, I don't have a ~ipad xib file. Does that mean I have to create another xib file for the ipad version and I can't use the existing one for the iphone and just change the dimensions using UI_USER_INTERFACE_IDIOM()?
ppn is offline   Reply With Quote
Old 10-20-2011, 10:07 PM   #4 (permalink)
Registered Member
 
Join Date: Jan 2009
Posts: 113
jonusx is on a distinguished road
Default

If you're doing a universal app, having two separate nibs isn't a bad idea
__________________
What do you have to share? Share and view pics Oneshare

Play Magic: The Gathering? Try The Sylvan Archives!

Warhammer 40k your thing? W40k Manager is your thing.

Like karaoke? Try iSing Karaoke Locator
jonusx is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
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
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 373
9 members and 364 guests
bignoggins, epaga, hussain1982, jcdevelopments, LunarMoon, markolo, omagod, pinacate, skog
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,643
Threads: 94,110
Posts: 402,860
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Diligent
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:54 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0