drewmccormack / ensembles

A synchronization framework for Core Data.
MIT License
1.63k stars 131 forks source link

iOS 6 crash when merging save notification #145

Closed roostr closed 10 years ago

roostr commented 10 years ago

Commit acf4657d broke the following code from Idiomatic sample app for iOS 6:

- (void)persistentStoreEnsemble:(CDEPersistentStoreEnsemble *)ensemble didSaveMergeChangesWithNotification:(NSNotification *)notification
{
    [managedObjectContext performBlock:^{
        [managedObjectContext mergeChangesFromContextDidSaveNotification:notification];
    }];
}

2014-05-30 19:14:18.641 App[710:907] -[_NSObjectID_64_7 objectID]: unrecognized selector sent to instance 0x1ede2d40

Confirmed that reverting acf4657d fixes it.

FYI: I also noticed that on iOS 6, this operation (merging the changes back into the UI context) doesn't work with acf4657d reverted. I have to force-close my app and restart it to see the model changes. This belongs in a separate issue, but I wanted to mention it here since it's relevant. Merging works fine on iOS 7.

roostr commented 10 years ago

It seems based on this documentation that passing real NSManagedObjects is the official way, so a revert of acf4657d may be best.

Still trying to figure out why the merge doesn't actually work.

drewmccormack commented 10 years ago

Hmm, that is odd. I made this change because it is how iCloud + Core Data does it. It includes the object ids, not be objects.

In general it is more convenient to have the object ids, because you can't really use the objects directly anyway.

Will try to reproduce the issue.

roostr commented 10 years ago

Let me know if you have issues reproducing it. For what it's worth, I can reliably reproduce it using an iOS 6 simulator & Dropbox backend. I haven't tested it with the Idiomatic app itself, but I am using very similar code. It's possible it's my own error.

On Sat, May 31, 2014 at 1:11 AM, Drew McCormack notifications@github.com wrote:

Hmm, that is odd. I made this change because it is how iCloud + Core Data does it. It includes the object ids, not be objects.

In general it is more convenient to have the object ids, because you can't really use the objects directly anyway.

Will try to reproduce the issue.

— Reply to this email directly or view it on GitHub https://github.com/drewmccormack/ensembles/issues/145#issuecomment-44718294 .

drewmccormack commented 10 years ago

I reverted this to provide NSManagedObjects instead. Just pull the master.