Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ppn

macrumors member
Original poster
Oct 31, 2010
36
0
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, I've hooked up the view with the File's Owner. The weird thing is it works on the iphone but fails on the ipad simulator. I just tried it on the ipad and it works. Anyone have the same bug?
 
Well, the error is quite straight forward, inside your XIB, you are not setting the view outlet. Maybe because you have checked the iphone XIB, and you need to check the iPad xib, or other way around. the error is there, and It's no bug.
 
I use the same XIB for both iphone and ipad. This works on my iPad but not the iPad simulator. Is that possible? I thought the simulator should reflect the actual ipad. Here's the rest of the error code if it helps.

Code:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "ResultsViewController" nib but the view outlet was not set.'
*** Call stack at first throw:
(
	0   CoreFoundation                      0x011e25a9 __exceptionPreprocess + 185
	1   libobjc.A.dylib                     0x01336313 objc_exception_throw + 44
	2   CoreFoundation                      0x0119aef8 +[NSException raise:format:arguments:] + 136
	3   CoreFoundation                      0x0119ae6a +[NSException raise:format:] + 58
	4   UIKit                               0x003ae709 -[UIViewController _loadViewFromNibNamed:bundle:] + 295
	5   UIKit                               0x003ac134 -[UIViewController loadView] + 120
	6   UIKit                               0x003ac00e -[UIViewController view] + 56
	7   UIKit                               0x003ada3d -[UIViewController viewControllerForRotation] + 63
	8   UIKit                               0x003a9988 -[UIViewController _visibleView] + 90
	9   UIKit                               0x0064b93c -[UIClientRotationContext initWithClient:toOrientation:duration:andWindow:] + 354
	10  UIKit                               0x0032381e -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 954
	11  UIKit                               0x005ab619 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 1381
	12  UIKit                               0x003b065d -[UIViewController presentModalViewController:withTransition:] + 3478
	13  MBClass5Test                        0x00011041 -[QuizViewController viewResults:] + 1393
	14  MBClass5Test                        0x0000ea23 -[QuizViewController nextQuestion:] + 291
	15  UIKit                               0x002fc4fd -[UIApplication sendAction:to:from:forEvent:] + 119
	16  UIKit                               0x0038c799 -[UIControl sendAction:to:forEvent:] + 67
	17  UIKit                               0x0038ec2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
	18  UIKit                               0x0038d7d8 -[UIControl touchesEnded:withEvent:] + 458
	19  UIKit                               0x00320ded -[UIWindow _sendTouchesForEvent:] + 567
	20  UIKit                               0x00301c37 -[UIApplication sendEvent:] + 447
	21  UIKit                               0x00306f2e _UIApplicationHandleEvent + 7576
	22  GraphicsServices                    0x01b3a992 PurpleEventCallback + 1550
	23  CoreFoundation                      0x011c3944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
	24  CoreFoundation                      0x01123cf7 __CFRunLoopDoSource1 + 215
	25  CoreFoundation                      0x01120f83 __CFRunLoopRun + 979
	26  CoreFoundation                      0x01120840 CFRunLoopRunSpecific + 208
	27  CoreFoundation                      0x01120761 CFRunLoopRunInMode + 97
	28  GraphicsServices                    0x01b391c4 GSEventRunModal + 217
	29  GraphicsServices                    0x01b39289 GSEventRun + 115
	30  UIKit                               0x0030ac93 UIApplicationMain + 1160
	31  MBClass5Test                        0x00001d39 main + 121
	32  MBClass5Test                        0x00001cb5 start + 53
	33  ???                                 0x00000001 0x0 + 1
)
 
No It doesn't really help :p The only thing I can tell you is, that a XIB on the simulator is not Capital Sensitive, and on the actual device it is. So a "RootViewController" and you type "rootViewController", will work on the simulator, but not on the actual device. That's the only thing I can figure out atm which could be your error.
 
Did you find answer to this?

I am running into the same error now. I have gone back and checked all the connections but cannot figure out what is going on.

Any help would be great.
Thank you.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.