ensembles: CDEEEventIntegrator mergeEventsWithCompletion:_block_invoke.91 Causing App Crash
My project was already up and running using Ensembles however once I migrated to Swift 3 my app now crashes. However the errors all point to the framework when debugging. I keep seeing the following error in the console when syncing;
Could not load any Objective-C class information. This will significantly reduce the quality of type information available.
or when I leave the app running I get the following memory issue
Message from debugger: Terminated due to memory issue
And when I dig further using instruments I found that the CPU over 100%, and memory and energy impact both high. When the app crashes It takes me to CDEEventIntegrator class, mergeEventsWithCompletion function and the dispatch line for `“integrate on background queue”.
Im unsure how to resolve this error, and I even turned iCloud drive for the app off in settings however the app still crashes sometime after launching. I have found with iCloud ManagedObjects would keep duplicating.
Here’s my Swift 3 functions in the appDelegate.
// MARK: Ensembles
var cloudFileSystem: CDECloudFileSystem!
var ensemble: CDEPersistentStoreEnsemble!
func syncWithCompletion(completion:@escaping (_ completed:Bool) -> Void) {
if !ensemble.isLeeched {
ensemble.leechPersistentStore { error in
if error != nil {
print("cannot leech \(error!.localizedDescription)")
completion(false)
}
else {
print("leached!!")
completion(true)
}
}
}
else {
ensemble.merge{ error in
if error != nil {
print("cannot merge \(error!.localizedDescription)")
completion(false)
}
else {
print("merged!!")
completion(true)
//NSNotificationCenter.defaultCenter().postNotificationName("Updated-DB", object: nil)
}
}
}
}
func persistentStoreEnsemble(_ ensemble: CDEPersistentStoreEnsemble, didSaveMergeChangesWith notification: Notification) {
managedObjectContext.performAndWait {
print("Database was updated from iCloud")
self.managedObjectContext.mergeChanges(fromContextDidSave: notification as Notification)
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "Updated-DB"), object: nil)
}
}
private func persistentStoreEnsemble(ensemble: CDEPersistentStoreEnsemble!, globalIdentifiersForManagedObjects objects: [AnyObject]!) -> [AnyObject]! {
return (objects as NSArray).value(forKeyPath: "uniqueIdentifier") as! [AnyObject]
}
This is what I am seeing in the console
As mentioned the project was working in previous versions of Swift, but now that my functions have been migrated to Swift 3 I am getting the errors mentioned. Does anyone have any ideas why this might be happening ?
PS: I was actually running final tests before submitting my app for iOS 10 and unfortunately this issue has prevented that. Weird how I haven’t had any issues until today
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 24 (13 by maintainers)
yep, 1.6.1 solve the problem. Unfortunately the version provided by CocoaPods is still the 1.6 so be sure to get the latest version from here by using in your PodFile
pod 'Ensembles', :git => 'https://github.com/drewmccormack/ensembles.git'You shouldn’t use CDEPropertyChangeValueTransformer. That is an internal transformer. Just use whichever transformer you were using before.
I’m not sure about the optional part. I may need to check if we handle that properly.
You may need to clear all the sync data that was created before the change. It may have the wrong values.
I think I see the problem. This was changed by Apple. We have a fix for the change in Git, but it hasn’t yet been released for Cocoapods yet.
I will try to release that in the coming days. For now, if you are able to use the HEAD of the Git repo, that should work.
Eg. In your pod file
Then