Swift 升级到Xcode 6.1时AppDelegate.swfit中出现编译错误
升级到xCode6.1后,我无法编译我的项目,上次还可以。我从未更改过此文件中的任何内容。请帮帮我 AppDelegate.swift:75:29:Swift 升级到Xcode 6.1时AppDelegate.swfit中出现编译错误,swift,xcode6.1,Swift,Xcode6.1,升级到xCode6.1后,我无法编译我的项目,上次还可以。我从未更改过此文件中的任何内容。请帮帮我 AppDelegate.swift:75:29: errorWithDomain(\ucode:userInfo:)”不可用:使用对象构造“n错误(域:code:userInfo:) 尝试在Xcode中使用此命令: cmd+shift+k 啊,我明白了。我还在Swift中开发,他们改变了一些标准的实现 您所需要做的就是将函数更改为Xcode所说的内容:)我的项目中有90处变化 因此,您需要将其更改
errorWithDomain(\ucode:userInfo:)”不可用:使用对象构造“n错误(域:code:userInfo:)
尝试在Xcode中使用此命令: cmd+shift+k 啊,我明白了。我还在Swift中开发,他们改变了一些标准的实现 您所需要做的就是将函数更改为Xcode所说的内容:)我的项目中有90处变化 因此,您需要将其更改为:
NSError(域:“您的错误域”,代码:9999,用户信息:dict)
在新的Xcode 6.3 Beta版中运行代码时出现此错误。这是您首次创建应用程序时生成的CoreData代码的一部分
*********************************以前*******************************************
//报告我们遇到的任何错误
设dict=NSMutableDictionary()
dict[NSLocalizedDescriptionKey]=“未能初始化应用程序保存的数据”
dict[NSLocalizedFailureReasonErrorKey]=故障原因
dict[NSUnderlyingErrorKey]=错误
error=NSError.errorWithDomain(“您的错误域”,代码:9999,用户信息:dict)
//将此替换为适当处理错误的代码
//abort()导致应用程序生成崩溃日志并终止。您不应该在装运应用程序中使用此函数,尽管它在开发过程中可能很有用
NSLog(“未解决的错误(error),(error!.userInfo)”)
中止
********************************之后*********************************************
var dict=[String:AnyObject]()
dict[NSLocalizedDescriptionKey]=“未能初始化应用程序保存的数据”
dict[NSLocalizedFailureReasonErrorKey]=故障原因
dict[NSUnderlyingErrorKey]=错误
error=n错误(域:“您的错误域”,代码:9999,用户信息:dict)
//将此替换为适当处理错误的代码。
//abort()导致应用程序生成崩溃日志并终止。您不应该在装运应用程序中使用此函数,尽管它在开发过程中可能很有用。
NSLog(“未解决的错误\(错误),\(错误!.userInfo)”)
中止()
重置iOS模拟器上的内容和设置对我来说很有效。Swift 4
如果此错误显示在核心数据中只需从模拟器或手机中删除/卸载你的应用程序(如果你在手机中运行),单击shift+cmd+H进入主页,长按应用程序图标,现在清理并构建你的应用程序
清洁-shift+cmd+k
内置-cmd+B
运行它
显示此错误的原因是您将项目文件夹从一台计算机复制到另一台计算机。太好了!非常感谢!真好,真是个笨蛋!这是一个评论。你将不得不等到你有足够的声誉,然后你可以发布它们。
lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator? = {
// The persistent store coordinator for the application. This implementation creates and return a coordinator, having added the store for the application to it. This property is optional since there are legitimate error conditions that could cause the creation of the store to fail.
// Create the coordinator and store
var coordinator: NSPersistentStoreCoordinator? = NSPersistentStoreCoordinator(managedObjectModel: self.managedObjectModel)
let url = self.applicationDocumentsDirectory.URLByAppendingPathComponent("PassNote.sqlite")
var error: NSError? = nil
var failureReason = "There was an error creating or loading the application's saved data."
if coordinator!.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: url, options: nil, error: &error) == nil {
coordinator = nil
// Report any error we got.
let dict = NSMutableDictionary()
dict[NSLocalizedDescriptionKey] = "Failed to initialize the application's saved data"
dict[NSLocalizedFailureReasonErrorKey] = failureReason
dict[NSUnderlyingErrorKey] = error
error = NSError.errorWithDomain("YOUR_ERROR_DOMAIN", code: 9999, userInfo: dict)
// Replace this with code to handle the error appropriately.
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
NSLog("Unresolved error \(error), \(error!.userInfo)")
abort()
}