My app store update build is crashing, it's a core data crash but I am getting this crash on only iOS 8 devices, it is working fine on iOS 9 devices. I have correctly performed light weight migration as well added the new model version keeping the old one as a base, added the dictionary in options as well while adding "addPersistentStoreWithType".
ManagedObjectModel
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("abcProject", withExtension: "momd")
NSLog("Url is - \(modelURL)")
return NSManagedObjectModel(contentsOfURL: modelURL!)!
}()
PersistentStoreCoordinator
lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator? = {
var coordinator: NSPersistentStoreCoordinator? = NSPersistentStoreCoordinator(managedObjectModel: self.managedObjectModel)
let url = self.applicationDocumentsDirectory.URLByAppendingPathComponent("abcProject")
var error: NSError? = nil
var failureReason = "There was an error creating or loading the application's saved data."
do {
let mOptions = [NSMigratePersistentStoresAutomaticallyOption: true, NSInferMappingModelAutomaticallyOption: true]
NSLog("TEST564 - 7 URL - \(url)")
try coordinator!.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: url, options: mOptions)
} catch var error1 as NSError {
error = error1
coordinator = nil
// Report any error we got.
var dict = [String: AnyObject]()
dict[NSLocalizedDescriptionKey] = "Failed to initialize the application's saved data"
dict[NSLocalizedFailureReasonErrorKey] = failureReason
dict[NSUnderlyingErrorKey] = error
error = NSError(domain: "YOUR_ERROR_DOMAIN", code: 9999, userInfo: dict)
// Replace this with code to handle the error appropriately.
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
NSLog("TEST564 Unresolved error \(error), \(error!.userInfo)")
abort()
} catch {
fatalError()
NSLog("TEST564 FATAL error")
}
return coordinator
}()
Above is my set of code for reference. I have searched everywhere and I get details about the light weight migration only.
Following is the device log after crash:-
> Jul 19 11:25:00 iPhone abcProject-Production[211] <Warning>: CoreData: error: -addPersistentStoreWithType:SQLite configuration:(null)
URL:file:///var/mobile/Containers/Data/Application/B12FCDA6-C91B-487E-8D03-CBBEB884996D/Documents/abcProject options:{
NSInferMappingModelAutomaticallyOption = 1;
NSMigratePersistentStoresAutomaticallyOption = 1;
} ... returned error Error Domain=NSCocoaErrorDomain Code=134130 "The operation couldn’t be completed. (Cocoa error 134130.)"
UserInfo=0x16b05490 {URL=file:///var/mobile/Containers/Data/Application/B12FCDA6-C91B-487E-8D03-CBBEB884996D/Documents/abcProject, metadata={
NSPersistenceFrameworkVersion = 519;
NSStoreModelVersionHashes = {
TabBanner = <3722cf8b 4ac58f43 20c84d7e 7d66865d a1382ecc 1ab25190 7b7c3fa7 843813fe>;
Video = <c51795f8 140c4936 de1b7615 03a944e7 f2b0451f 3c0b5887 2cfb31d3 07610d22>;
};NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers = (
""
);
NSStoreType = SQLite;
NSStoreUUID = "79788D63-BEF2-4339-BF60-1580904D9B44";
"_NSAutoVacuumLevel" = 2;
}, reason=Can't find model for source store} with userInfo dictionary {
URL = "file:///var/mobile/Containers/Data/Application/B12FCDA6-C91B-487E-8D03-CBBEB884996D/Documents/abcProject";
metadata = {
NSPersistenceFrameworkVersion = 519;
NSStoreModelVersionHashes = {
TabBanner = <3722cf8b 4ac58f43 20c84d7e 7d66865d a1382ecc 1ab25190 7b7c3fa7 843813fe>;
Video = <c51795f8 140c4936 de1b7615 03a944e7 f2b0451f 3c0b5887 2cfb31d3 07610d22>;
};
NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers = (
""
);
NSStoreType = SQLite;
NSStoreUUID = "79788D63-BEF2-4339-BF60-1580904D9B44";
"_NSAutoVacuumLevel" = 2;
};
reason = "Can't find model for source store";
}
Jul 19 11:25:00 iPhone abcProject-Production[211] <Warning>: CoreData: annotation: NSPersistentStoreCoordinator's current model hashes are {
TabBanner = <2efd2387 6f370f71 d585132f 9d6aa8fe afcdc841 ef6e9b89 396625d1 cbc99cea>;
Video = <c51795f8 140c4936 de1b7615 03a944e7 f2b0451f 3c0b5887 2cfb31d3 07610d22>;
}
Jul 19 11:25:00 iPhone abcProject-Production[211] <Warning>: Unresolved error Optional(Error Domain=YOUR_ERROR_DOMAIN Code=9999 "Failed to initialize the application's saved data" UserInfo=0x168e0c90 {NSLocalizedDescription=Failed to initialize the application's saved data, NSUnderlyingError=0x16b05350 "The operation couldn’t be completed. (Cocoa error 134130.)", NSLocalizedFailureReason=There was an error creating or loading the application's saved data.}), [NSLocalizedDescription: Failed to initialize the application's saved data, NSUnderlyingError: Error Domain=NSCocoaErrorDomain Code=134130 "The operation couldn’t be completed. (Cocoa error 134130.)"
UserInfo=0x16b05490 {URL=file:///var/mobile/Containers/Data/Application/B12FCDA6-C91B-487E-8D03-CBBEB884996D/Documents/abcProject, metadata={
NSPersistenceFrameworkVersion = 519;
NSStoreModelVersionHashes = {
TabBanner = <3722cf8b 4ac58f43 20c84d7e 7d66865d a1382ecc 1ab25190 7b7c3fa7 843813fe>;
Video = <c51795f8 140c4936 de1b7615 03a944e7 f2b0451f 3c0b5887 2cfb31d3 07610d22>;
};
NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers = (
""
);
NSStoreType = SQLite;
NSStoreUUID = "79788D63-BEF2-4339-BF60-1580904D9B44";
"_NSAutoVacuumLevel" = 2;
}, reason=Can't find model for source store}, NSLocalizedFailureReason: There was an error creating or loading the application's saved data.]
Jul 19 11:25:01 iPhone ReportCrash[212] <Error>: task_set_exception_ports(B07, 400, D03, 0, 0) failed with error (4: (os/kern) invalid argument)
Jul 19 11:25:01 iPhone ReportCrash[212] <Notice>: ReportCrash acting against PID 211
Jul 19 11:25:01 iPhone ReportCrash[212] <Notice>: Formulating crash report for process abcProject-Production[211]
Jul 19 11:25:01 iPhone SpringBoard[43] <Warning>: BSXPCMessage received error for message: Connection invalid
Jul 19 11:25:01 iPhone SpringBoard[43] <Warning>: Unable to get short BSD proc info for 211: No such process
Jul 19 11:25:01 iPhone SpringBoard[43] <Warning>: Unable to get short BSD proc info for 211: No such process
Jul 19 11:25:01 iPhone mediaserverd[37] <Notice>: '' com.abcProject(pid = 211) setting DiscoveryMode = DiscoveryMode_None, currentDiscoveryMode = DiscoveryMode_None
Jul 19 11:25:01 iPhone wifid[69] <Notice>: WiFi:[490600501.266659]: Foreground Network Application exited.
Jul 19 11:25:01 iPhone AppStore[175] <Warning>: [SSMetricsEventController] Direct-access controller is calling through XPC to flush Unreported Events
Jul 19 11:25:01 iPhone wifid[69] <Notice>: WiFi:[490600501.267352]: BG Application: Not Present, BG Daemon: Present. Daemons: apsd itunesstored networkd
Jul 19 11:25:01 iPhone locationd[64] <Notice>: Gesture EnabledForTopCLient: 0, EnabledInDaemonSettings: 0
Jul 19 11:25:01 iPhone com.apple.xpc.launchd[1] (UIKitApplication:com.abcProject[0xb6e0][211]) <Notice>: Service exited due to signal: Abort trap: 6
Jul 19 11:25:01 iPhone com.apple.xpc.launchd[1] (UIKitApplication:com.abcProject[0xb6e0]) <Notice>: Service only ran for 6 seconds. Pushing respawn out by 2147483641 seconds.
Jul 19 11:25:01 iPhone locationd[64] <Notice>: Gesture EnabledForTopCLient: 0, EnabledInDaemonSettings: 0
Jul 19 11:25:01 iPhone SpringBoard[43] <Warning>: Application 'UIKitApplication:com.abcProject[0xb6e0]' crashed.
Jul 19 11:25:01 iPhone assertiond[58] <Warning>: pid_suspend failed for <BKNewProcess: 0x1668b480; com.abcProject; pid: 211; hostpid: -1>: Unknown error: -1, Unknown error: -1
Jul 19 11:25:01 iPhone assertiond[58] <Warning>: Could not set priority of <BKNewProcess: 0x1668b480; com.abcProject; pid: 211; hostpid: -1> to 2, priority: No such process
Jul 19 11:25:01 iPhone assertiond[58] <Warning>: Could not set priority of <BKNewProcess: 0x1668b480; com.abcProject; pid: 211; hostpid: -1> to 4096, priority: No such process
Jul 19 11:25:01 iPhone UserEventAgent[17] <Warning>: id=com.abcProject pid=211, state=0
Jul 19 11:25:01 iPhone ReportCrash[212] <Notice>: Saved report to /var/mobile/Library/Logs/CrashReporter/abcProject-Production_2016-07-19-112501_iPhone.ips
Jul 19 11:25:06 iPhone wifid[69] <Notice>: WiFi:[490600506.681414]: WiFi unquiescing requested by "locationd"
Jul 19 11:25:06 iPhone wifid[69] <Notice>: WiFi:[490600506.686744]: WiFi unquiescing requested by "locationd"
Jul 19 11:25:06 iPhone wifid[69] <Notice>: WiFi:[490600506.743193]: WiFi unquiescing requested by "locationd"
Jul 19 11:25:08 iPhone wifid[69] <Notice>: WiFi:[490600508.843256]: Client itunesstored set type to normal application
Jul 19 11:25:08 iPhone wifid[69] <Notice>: WiFi:[490600508.844080]: __WiFiManagerSetEnableState: state TRUE, manager->enable.setting TRUE, manager->unlockedSinceBoot TRUE
Jul 19 11:25:08 iPhone wifid[69] <Notice>: WiFi:[490600508.845449]: BG Application: Not Present, BG Daemon: Present. Daemons: apsd networkd
Jul 19 11:25:09 iPhone locationd[64] <Notice>: Gesture EnabledForTopCLient: 0, EnabledInDaemonSettings: 0
Jul 19 11:25:12 iPhone aggregated[29] <Warning>: Scheduling parameters: 0 minutes before midnight, 4.0 time(s)/day
Jul 19 11:25:12 iPhone aggregated[29] <Warning>: delay: 595 into interval 21600 => 22195
Jul 19 11:25:12 iPhone aggregated[29] <Warning>: Next ADDaily run scheduled in 06:09:55 at 2016-07-19 12:05:07 +0000
Jul 19 11:25:12 iPhone addaily[213] <Warning>: addaily started
Jul 19 11:25:12 iPhone addaily[213] <Warning>: daily tasks for day 17000
Jul 19 11:25:13 iPhone addaily[213] <Warning>: Filtering only beta sessions
Jul 19 11:25:13 iPhone addaily[213] <Warning>: Saved Sessions as /var/mobile/Library/Logs/CrashReporter/log-sessions-2016-07-19-112513.session
Jul 19 11:25:23 iPhone addaily[213] <Warning>: addaily ended