Bug在iPhone模拟器5.1与Xcode 4.5使用UIManagedDocument [英] Bug in iPhone Simulator 5.1 with Xcode 4.5 using UIManagedDocument

查看:115
本文介绍了Bug在iPhone模拟器5.1与Xcode 4.5使用UIManagedDocument的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常奇怪的问题,我花了最后两天试图解决...我有一块代码,在Xcode 4.4和iOS 5.1模拟器,使用5.1 SDK的工作完美。在我更新到Xcode 4.5和6.0 SDK后,我的代码停止在iOS 5.1模拟器中工作...即使它在iOS 6.0模拟器中工作得很好。是否有任何变化,我不知道?

I have a very weird problem I've spent the last two days trying to solve... I had a piece of code that was working perfectly fine on Xcode 4.4 and iOS 5.1 Simulator, using the 5.1 SDK. After I updated to Xcode 4.5 and the 6.0 SDK, my code stopped working in the iOS 5.1 Simulator... even though it works perfectly fine in the iOS 6.0 Simulator. Was there any change I'm not aware of?

这是代码:

- (void)useDocument
{
    if (![[NSFileManager defaultManager] fileExistsAtPath:[self.database.fileURL path]]){
        [self.database saveToURL:self.database.fileURL forSaveOperation:UIDocumentSaveForCreating completionHandler:^(BOOL success){
            [self setupFetchedResultsController];
    }];
    } else if (self.database.documentState == UIDocumentStateClosed){
        [self.database openWithCompletionHandler:^(BOOL success){
            [self setupFetchedResultsController];
        }];          
    } else if (self.database.documentState == UIDocumentStateNormal) {
        [self setupFetchedResultsController];
    }
}

由于某种原因,saveToURL和openWithCompletionHandler从不返回5.1模拟器。任何人都知道为什么?

For some reason saveToURL and openWithCompletionHandler never return in the 5.1 Simulator. Any one knows why?

推荐答案

我有同样的问题,iPhone模拟器5.1。
该文件在长时间(30秒)后创建。但是从不调用完成处理程序。您是在装置上试用吗?

I have the same problem under iPhone Simulator 5.1. The file is created after a long time (30 seconds). But the completion handler is never called. Did you try it on a device?

编辑:这似乎是iOS模拟器5.1的一个错误。我编译在我的旧iPad上的代码与iOS 5.1.1,它的工作没有错误!

This seems a bug in iOS Simulator 5.1. I compiled the code on my old iPad with iOS 5.1.1 and it worked without an error!

这篇关于Bug在iPhone模拟器5.1与Xcode 4.5使用UIManagedDocument的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆