使用 UIManagedDocument 的 iPhone Simulator 5.1 和 Xcode 4.5 中的错误 [英] Bug in iPhone Simulator 5.1 with Xcode 4.5 using UIManagedDocument

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

问题描述

我有一个非常奇怪的问题,我花了两天时间试图解决...我有一段代码在 Xcode 4.4 和 iOS 5.1 Simulator 上运行得非常好,使用 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 Simulator 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 Simulator 5.1 中的一个错误.我在使用 iOS 5.1.1 的旧 iPad 上编译了代码,并且没有错误!

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!

这篇关于使用 UIManagedDocument 的 iPhone Simulator 5.1 和 Xcode 4.5 中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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