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

zerocustom1989

macrumors regular
Original poster
Sep 5, 2007
247
22
Hey guys, I've been racking my brain over this for the past hour and im just about out of ideas.

I have the following code as activated by a button on an ActionSheet.

Code:
-(void) actionSheet:(UIActionSheet *)actionSheet willDismissWithButtonIndex:(NSInteger)buttonIndex {
	if(buttonIndex != [actionSheet cancelButtonIndex]){
		if (buttonIndex == ASSemesterButtonIndex) {
			//SemesterAdd has been pressed. load the add semester modal view
			SemesterAddViewController *addSemesterController = [[SemesterAddViewController alloc] initWithNibName:@"SemesterAddViewController" bundle:nil];
			addSemesterController.delegate = self;
			
			Semester *newSemester = [NSEntityDescription insertNewObjectForEntityForName:@"Semester" inManagedObjectContext:self.managedObjectContext];
			addSemesterController.semester = newSemester;
			
			UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:addSemesterController];
			[self presentModalViewController:navigationController animated:YES];
			
			[navigationController release];
			[addSemesterController release];

		}
	}
}

I know this means that only the top button works, and that the other buttons do nothing but retract the sheet. My problem occurs with the following line:
Code:
[self presentModalViewController:navigationController animated:YES];

I used some breakpoints and found that that line was causing my crash.

If you guys have any hunches please let me know.

Thank You.

PS, Anyone know any good resources for learning to use the debugger in Xcode?
 
Gah, something was wrong with the viewdidload method in the viewcontroller for the modal view.

I found it out by commenting a block of code out. Not sure how to find these errors in a more proper fashion.

I'd delete this thread if I knew how. Thanks to the people that viewed this.
 
You could manual add a break point to the objc_exception_throw, this will cause the app to stop on any objc_exception. This from in the debugger window you can type "where" without the quotes. This can give you a stack trace and will allow you to back track to the line that is causing the crash.
 
It's not required to manually set a breakpoint on objc_exception_throw (anymore). Choose Run > Stop On Objective-C Exceptions and that's the same thing.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.