NSInteger couter = 0; while (self.aa == nil && couter < 10) { NSLog(@"aa为空,阻塞不去构造JSON字典"); couter++;
//每隔一秒检查一下aa是否为空,最多尝试10次. [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1]]; }
原文:http://www.cnblogs.com/wb145230/p/4427866.html