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

bluehill

macrumors newbie
Original poster
Feb 5, 2011
22
0
when i call a alertview from NSNotification function the alertview is called but the screen gets dim.
This function is already getting called from a thread(NSInvocationOperation).

like the screen in following url...
http://stackoverflow.com/questions/4325403/nsnotification-stops-method-from-working-completely

i tried to use the solution provided in the same url but couldn't succeed...
The solution is as follows
When you call the method from the NSNotificationCenter, the method is not on the GUI thread. You have to execute the AlertDialog show and TableView reloading on the GUI thread using performSelectorOnMainThread



Code:
-(void)reloadMainView:(NSNotification*)notify{
	self.navigationItem.rightBarButtonItem = nil; 
	[self.view setNeedsDisplay];
	
	/*
         [self.view performSelectorOnMainThread:@selector(updateComplete) withObject:nil waitUntilDone:[NSThread isMainThread]]; */

}

-(void)updateComplete{
	NSLog(@"timere claled");
	UIAlertView *alert = [[UIAlertView alloc] 
						  initWithTitle: @"Update complete" 
						  message:@"Update will take effect on next startup."
						  delegate:self
						  cancelButtonTitle:@"OK"
						  otherButtonTitles:nil];
	
	[alert show];
	[alert release];
}
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.