From da170c7e51c45ca44f1af5dd9e28170c5df64398 Mon Sep 17 00:00:00 2001 From: John Estropia Date: Wed, 23 Aug 2017 18:40:06 +0900 Subject: [PATCH] Fixed Xcode 9 beta 6 errors --- Sources/XcodeDataModelSchema.swift | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Sources/XcodeDataModelSchema.swift b/Sources/XcodeDataModelSchema.swift index 19a9819..e4db7ff 100644 --- a/Sources/XcodeDataModelSchema.swift +++ b/Sources/XcodeDataModelSchema.swift @@ -145,7 +145,7 @@ public final class XcodeDataModelSchema: DynamicSchema { public required init(modelName: ModelVersion, modelVersionFileURL: URL) { CoreStore.assert( - FileManager.default.fileExists(atPath: modelVersionFileURL.path), + NSManagedObjectModel(contentsOf: modelVersionFileURL) != nil, "Could not find the \"\(modelName).mom\" version file for the model at URL \"\(modelVersionFileURL)\"." ) @@ -164,13 +164,12 @@ public final class XcodeDataModelSchema: DynamicSchema { return cachedRawModel } - CoreStore.assert( - FileManager.default.fileExists(atPath: self.modelVersionFileURL.path), - "Could not find the \"\(self.modelVersion).mom\" version file for the model at URL \"\(self.modelVersionFileURL)\"." - ) - let rawModel = NSManagedObjectModel(contentsOf: self.modelVersionFileURL) - self.cachedRawModel = rawModel - return rawModel + if let rawModel = NSManagedObjectModel(contentsOf: self.modelVersionFileURL) { + + self.cachedRawModel = rawModel + return rawModel + } + CoreStore.abort("Could not create an \(cs_typeName(NSManagedObjectModel.self)) from the model at URL \"\(self.modelVersionFileURL)\".") }