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

php - Passing multiple values in a url using checkbox -

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

sql - Postgresql tables exists, but getting "relation does not exist" when querying -