查看我的代码,我只是使用一个标志来指定打开的doc操作是否是完全匹配的,但是主线程似乎永远存在......
__block BOOL waitingOnCompletionHandler = YES;
[_managedDocument openWithCompletionHandler:^(BOOL success) {
if (success) {
DLog(@"open document succeed!");
self.managedObjectContext = _managedDocument.managedObjectContext;
waitingOnCompletionHandler = NO;
}
}];
while (waitingOnCompletionHandler) {
usleep(USEC_PER_SEC/10);
//use the managedDoc to process some thing here
}