【发布时间】:2017-05-18 17:57:27
【问题描述】:
目前我正在处理我在 swift2 中的一个项目,我正在转换为 swift 3。我收到以下错误:
不能调用非函数类型'Bundle'的值
在
let modelURL = Bundle.mainBundle().URLForResource("VerseApp", withExtension: "momd")!
以下是代码:
lazy var managedObjectModel: NSManagedObjectModel = {
let modelURL = Bundle.mainBundle().URLForResource("VerseApp", withExtension: "momd")!
print(modelURL)
return NSManagedObjectModel(contentsOfURL: modelURL)!
}()
【问题讨论】:
-
这行有错误吗?让 modelURL = Bundle.mainBundle().URLForResource("VerseApp", withExtension: "momd")!
-
帮助自己的简单提示:⌘-单击符号 (
Bundle) 并在头文件中查找方法。