I am attempting to rename a project in XCode7. After renaming it, it compiles fine, but I am getting a runtime error in this code block:
lazy var managedObjectModel: NSManagedObjectModel = {
// The managed object model for the application. This property is not optional. It is a fatal error for the application not to be able to find and load its model.
let modelURL = NSBundle.mainBundle().URLForResource("Test File", withExtension: "momd")!
return NSManagedObjectModel(contentsOfURL: modelURL)!
}()
The exception that I'm getting is:
UpDown Count[6149:4086716] CoreData: Failed to load NSManagedObjectModel with URL 'file:///Users/Scott/Library/Developer/CoreSimulator/Devices/C66F52A5-3979-4D8D-A80D-337FDDCFDB29/data/Containers/Bundle/Application/B4D6F673-6EA9-446D-B29E-F769EAC33B38/Test%20File.app/Test%20File.momd/' fatal error: unexpectedly found nil while unwrapping an Optional value
I have tried resetting the simulator, and it did nothing.
I've renamed projects before, and had no problems. This is the first one that I've tried to rename that has core data.