ios - Wait until NSNotification is Received -


i have method pauses execution until notification received before continuing. continue execution after notifications received. best way go doing this?

you can using nsrunloop

- (bool)method { __block bool finish = no; [[nsnotificationcenter defaultcenter] addobserverforname:@"mynotification" object:nil queue:nil usingblock:^(nsnotification *note) {     finish = yes; }];  while(!finish) {     [[nsrunloop currentrunloop] rununtildate:[nsdate datewithtimeintervalsincenow:0.1]]; }  return yes; } 

Comments

Popular posts from this blog

compilation - PHP install fails on Ubuntu 14 (make: *** [sapi/cli/php] Error 1) PHP 5.6.20 -

javascript - return highlighted cells to php -

java - Creating a room by reading from a file (for a game) -