任何人都可以解释为什么以下代码会在Xcode 6版本的发布版本中崩溃而在调试版本中不会崩溃?
我可以将此广告作为试图阻止此
的内容// Check if iCloud is enabled
if let currentToken = NSFileManager.defaultManager().ubiquityIdentityToken {
// The following line causes a crash in Release version
FLOG(" currentUbiquityIdentityToken is \(currentToken)")
编辑:
当#34; DataModel"更多挖掘和问题是由此代码引起的。名称已更改为其他内容。我原以为"让modelURL = NSBundle。" line抛出一个异常,但事实并非如此。似乎只是纯粹的巧合,调试器在" FLOG(...)"抛出错误访问异常时的代码行。
lazy var managedObjectModel: NSManagedObjectModel = {
// The managed object model for the application. This property is not optional. It is a fatal error for the application not to be able to find and load its model.
let modelURL = NSBundle.mainBundle().URLForResource("DataModel", withExtension: "momd")!
return NSManagedObjectModel(contentsOfURL: modelURL)!
}()