我有代码:
static var default: Realm {
do {
return try Realm()
} catch let error {
try? FileManager.default.removeItem(at: Realm.Configuration.defaultConfiguration.fileURL!)
return try! Realm()
}
}
我稍后发布它后开始崩溃return try! Realm()
。
你能解释一下我的原因吗?下面我添加了崩溃日志。我们没有使用数据或使用它们的代码更改任何内容。我们所做的只是更新Realm pod。
`
0 libswiftCore.dylib 0x00000001062bf9b0 0x1060e0000 + 1964464
1 libswiftCore.dylib 0x000000010616fa04 0x1060e0000 + 588292
2 XXXX 0x0000000104b90ca0 function signature specialization <Arg[0] = Dead> of static (extension in XXX):RealmSwift.Realm.default.getter : RealmSwift.Realm (Realm+Extensions.swift:31)
3 XXXX 0x0000000104b23288 function signature specialization <Arg[0] = Owned To Guaranteed> of XXX.TripListController.init(coder: __ObjC.NSCoder) -> XXX.TripListController? (TripListController.swift:0)
4 XXXX 0x0000000104b1d438 @objc XXX.TripListController.init(coder: __ObjC.NSCoder) -> XXX.TripListController? (TripListController.swift:0)
5 UIKit 0x000000018c0fca24 -[UIClassSwapper initWithCoder:] + 244
6 UIKit 0x000000018c2aa380 UINibDecoderDecodeObjectForValue + 684
7 UIKit 0x000000018c2aa0b8 -[UINibDecoder decodeObjectForKey:] + 100
8 UIKit 0x000000018c0fc6c8 -[UIRuntimeConnection initWithCoder:] + 184
9 UIKit 0x000000018c0fce68 -[UIRuntimeEventConnection initWithCoder:] + 64
10 UIKit 0x000000018c2aa380 UINibDecoderDecodeObjectForValue + 684
11 UIKit 0x000000018c2aa4f8 UINibDecoderDecodeObjectForValue + 1060
12 UIKit 0x000000018c2aa0b8 -[UINibDecoder decodeObjectForKey:] + 100
13 UIKit 0x000000018c0fba08 -[UINib instantiateWithOwner:options:] + 1164
14 UIKit 0x000000018c480e98 -[UIStoryboard instantiateViewControllerWithIdentifier:] + 192
15 UIKit 0x000000018c25dab0 -[UIStoryboardViewControllerPlaceholder initWithCoder:] + 160
`