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
Post a Comment