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

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

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

asp.net mvc - breakpoint on javascript in CSHTML? -