AppDelegate中的EXC_BAD_INSTRUCTION错误(Bundle.main.url?)

时间:2016-11-03 04:26:41

标签: ios bundle appdelegate exc-bad-instruction

我在AppDelegate中遇到问题,但找不到错误,我检查了包标识符,但它仍然无效,有我的代码:

lazy var applicationDocumentsDirectory: NSURL = {
    let urls = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
    return urls[urls.count-1] as NSURL
}()

lazy var managedObjectModel: NSManagedObjectModel = {
    let modelURL = Bundle.main.url(forResource: "koalak", withExtension: "momd")!
    return NSManagedObjectModel(contentsOf: modelURL)!
}()

我得到错误的屏幕截图:

 EXC_BAD_INSTRUCTION Error Screenshot

enter image description here

0 个答案:

没有答案