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

Howiieque

macrumors regular
Original poster
Feb 1, 2009
120
0
Code:
for (;;) {
		UIAlertView *alertView=[[UIAlertView alloc] initWithTitle:@"I wanna know you" message:currentNode.question delegate:self cancelButtonTitle:@"Skip" otherButtonTitles:currentNode.option1, currentNode.option2, nil];
		[alertView show];
		[alertView release];
	}


it seems that it can get the result i want. this even won't show the alert view at all. can someone explain the reason.
 
Is that running on the main thread? If so don't do that. OK, actually don't do that on any thread. Ever.

Showing an alert does not block the current thread or stop execution. That is looping as fast as the CPU can creating and asking for alerts to show. You'll run out of RAM and the app will crash (eventually). You need to allow the current iteration of the run loop to end for the alert to show.

Create the alert, show it and use the delegate callbacks...
 
thank you for your reply. your answer really makes sense.
i still have something can't understand. it is said that everything is blocked when modal view appears.
i upload my test codes. it seems that when i press any of the button, it will result in EXC_BAD_ACCESS. can you tell me a little more about that?
 

Attachments

  • Archive.zip
    4 KB · Views: 62
thank you for your reply. your answer really makes sense.
i still have something can't understand. it is said that everything is blocked when modal view appears.
i upload my test codes. it seems that when i press any of the button, it will result in EXC_BAD_ACCESS. can you tell me a little more about that?

Where? The documentation for show just says it shows it. It also says if you are using custom buttons you MUST supply a delegate. Which you are not.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.