如何打开UIManagedDocument同步?

时间:2013-06-25 21:52:13

标签: ios uimanageddocument

查看我的代码,我只是使用一个标志来指定打开的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
    }

0 个答案:

没有答案