drewmccormack / ensembles

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

Weird issue leeching to DropBox #221

Closed jacobcaraballo closed 8 years ago

jacobcaraballo commented 8 years ago

I'm having a weird issue trying to leech to dropbox. Here are the steps that lead to the issue:

  1. I leech to dropbox the first time. It works fine and merges data successfully.
  2. I deleech from dropbox, apparently successful with no issues.
  3. Now, if I try to leech to any other service, I get the following error:

Attempt to create an Ensemble for a persistent store for which an ensemble is already active: file:///private/var/mobile/Containers/Shared/AppGroup/16A728B4-D8C3-4451-89EB-C7A06D143125/Core <<< -[CDEPersistentStoreEnsemble initWithEnsembleIdentifier:persistentStoreURL:persistentStoreOptions:managedObjectModelURL:cloudFileSystem:localDataRootDirectoryURL:] line 93

This error occurs when trying to setup the ensemble again with the new service and returns nil. It eventually crashes the app, since it attempts to call the leech method on a nil ensemble.

The weird thing is that if I do steps 1 & 2 and then restart the app, step 3 doesn't give an error and leeches successfully.

I've been trying to figure this out for a few days now on my own, but still unsuccessful.

drewmccormack commented 8 years ago

The ensemble object you first created must still be there when you create the second ensemble.

The best fix is to call 'dismantle' on the first ensemble when you are about to discard it.

Kind regards, Drew

On 10 Mar 2016, at 01:54, Jacob Caraballo notifications@github.com wrote:

I'm having a weird issue trying to leech to dropbox. Here are the steps that lead to the issue:

  1. I leech to dropbox the first time. It works fine and merges data successfully.
  2. I deleech from dropbox, apparently successful with no issues.
  3. Now, if I try to leech to any other service, I get the following error:

Attempt to create an Ensemble for a persistent store for which an ensemble is already active: file:///private/var/mobile/Containers/Shared/AppGroup/16A728B4-D8C3-4451-89EB-C7A06D143125/Core <<< -[CDEPersistentStoreEnsemble initWithEnsembleIdentifier:persistentStoreURL:persistentStoreOptions:managedObjectModelURL:cloudFileSystem:localDataRootDirectoryURL:] line 93

The weird thing is that if I do steps 1 & 2 and then restart the app, step 3 doesn't give an error and leeches successfully.

I've been trying to figure this out for a few days now on my own, but still unsuccessful.

— Reply to this email directly or view it on GitHub.

jacobcaraballo commented 8 years ago

That was exactly it! I can't believe I spent so much time on this and it was such a simple fix. Thanks so much for your quick reply!