iphone - NSNotification stops method from working completely -


i have method:

- (void)reloadmessages:(nsnotification *)notification {     nslog(@"recieved new messages messagesrootviewcontroller");      // need threads database...     nsfetchrequest *thereq = [[nsfetchrequest alloc] init];     nsentitydescription *entity = [nsentitydescription entityforname:@"thread" inmanagedobjectcontext:managedobjectcontext];     [thereq setentity:entity];      threads = [[managedobjectcontext executefetchrequest:thereq error:nil] retain];      uialertview *alert = [[uialertview alloc] initwithtitle:@"new message" message:@"new message" delegate:nil cancelbuttontitle:@"thanks" otherbuttontitles:nil];     [alert show];     [alert release];      [self.tableview reloaddata];  } 

if call [self reloadmessages:nil] function works prescribed above.

if called nsnotificationcenter notification: [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(reloadmessages:) name:@"newmessagesarrived" object:nil]; gets [alert show] , stops screen dimmed per screenshot:

alt text

any idea why happening?

if take away uialertview bit , leave [self.tableview reloaddata]; calls function, stops @ point. nslogging on table view datasource methods reveals table view updated correct number of rows (suggesting core data request isn't causing problem) cellforrowatindexpath isn't being called.

the program isn't crashing. without alert view table view doesn't quite reload above, view still useable , moving table view causes rows update appropriately (as going contacts tab , again).

if need more information can give it.

thanks help. :)

tom

when call method nsnotificationcenter, method not on gui thread. have execute alertdialog show , tableview reloading on gui thread using performselectoronmainthread


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -