Fix some startup warnings

This commit is contained in:
Yishi Lin 2017-06-15 17:30:57 +08:00
parent 9bb51d209c
commit a8060d28c9
2 changed files with 6 additions and 0 deletions

View file

@ -112,6 +112,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
let modelURL = Bundle(identifier: Globals.passKitBundleIdentifier)!.url(forResource: "pass", withExtension: "momd")!
let managedObjectModel = NSManagedObjectModel(contentsOf: modelURL)
let container = NSPersistentContainer(name: "pass", managedObjectModel: managedObjectModel!)
if FileManager.default.fileExists(atPath: Globals.documentPath) {
try! FileManager.default.createDirectory(atPath: Globals.documentPath, withIntermediateDirectories: true, attributes: nil)
}
container.persistentStoreDescriptions = [NSPersistentStoreDescription(url: URL(fileURLWithPath: Globals.dbPath))]
container.loadPersistentStores(completionHandler: { (storeDescription, error) in
if let error = error as NSError? {