lars
lars

Reputation: 249

iCloud Core Data lightweight migration - entities disappear

In my app, that is available on the Mac Appstore I have iCloud + Core Data integrated for Mavericks users. So I use the latest iCloud implementation, which wasn’t so buggy as the old one… I thought.

Until now everything was fine, with the latest update of the app I made small changes to the Database, just adding a few new properties to an entity and created a new model version for this of course.

If you start the updated version, all data is there and everything is fine. All entities are still there. This is the console output:

storesDidChange: {
    added =     (
        "<NSSQLCore: 0x100410d10> (URL: file:///Users/lars/Library/Containers/de.nulldesign.tyme.osx/Data/Library/Application%20Support/de.nulldesign.tyme/CoreDataUbiquitySupport/lars~053CB071-18DD-5ED8-B2F0-DD0341B523C7/iCloudStore/2B3578B9-3A28-492B-8C62-BFF7FE7076F3/store/TymeCloud.storedata)"
    );
}

-[PFUbiquitySwitchboardEntryMetadata setUseLocalStorage:](760): CoreData: Ubiquity:  lars~053CB071-18DD-5ED8-B2F0-DD0341B523C7:iCloudStore 
Using local storage: 1

After a short while, this importer error occures:

__76-[_PFUbiquityRecordsImporter batchDownloadTransactionLogsAtLocations:error:]_block_invoke(763): CoreData: Ubiquity:  Librian returned a serious error for starting downloads Error Domain=LibrarianErrorDomain Code=1 "Der Vorgang konnte nicht abgeschlossen werden. (LibrarianErrorDomain-Fehler 1 - Unable to initiate download.)" UserInfo=0x600000271440 {NSDescription=Unable to initiate download., Item Errors={
    "file:///Users/lars/Library/Mobile%20Documents/HR22V4547K~de~nulldesign~tyme/CoreData/iCloudStore/lars~053CB071-18DD-5ED8-B2F0-DD0341B523C7/iCloudStore/16Dv7DuLeM4RoFUBtAVIQokfWJRwGABtWC81frFMCp0=/7B142E0C-3C97-4344-B647-28330E5D7FE3.1.cdt" = "Error Domain=UBErrorDomain Code=0 \"Der Vorgang konnte nicht abgeschlossen werden. (UBErrorDomain-Fehler 0 - Error Domain=UBErrorDomain Code=0 \"The operation couldn\U2019t be completed. (UBErrorDomain error 0.)\")\" 
…
UserInfo=0x600000271600 {NSDescription=Error Domain=UBErrorDomain Code=0 \"The operation couldn\U2019t be completed. (UBErrorDomain error 0.)\"}";
    };
    NSDescription = "Unable to initiate download.";
    NSUnderlyingError = "Error Domain=UBErrorDomain Code=0 \"Der Vorgang konnte nicht abgeschlossen werden. (UBErrorDomain-Fehler 0.)\"";
}

Then a stores will change event fires:

storesWillChange: {
    NSPersistentStoreUbiquitousTransitionTypeKey = 4;
    added =     (
        "<NSSQLCore: 0x100211490> (URL: file:///Users/lars/Library/Containers/de.nulldesign.tyme.osx/Data/Library/Application%20Support/de.nulldesign.tyme/CoreDataUbiquitySupport/lars~053CB071-18DD-5ED8-B2F0-DD0341B523C7/iCloudStore/2B3578B9-3A28-492B-8C62-BFF7FE7076F3/store/TymeCloud.storedata)"
    );
    removed =     (
        "<NSSQLCore: 0x100211490> (URL: file:///Users/lars/Library/Containers/de.nulldesign.tyme.osx/Data/Library/Application%20Support/de.nulldesign.tyme/CoreDataUbiquitySupport/lars~053CB071-18DD-5ED8-B2F0-DD0341B523C7/iCloudStore/2B3578B9-3A28-492B-8C62-BFF7FE7076F3/store/TymeCloud.storedata)"
    );
}

And quite a few storesWillChange & storesDidChange shorty after:

storesDidChange: {
    removed =     (
        "<NSSQLCore: 0x100410d10> (URL: file:///Users/lars/Library/Containers/de.nulldesign.tyme.osx/Data/Library/Application%20Support/de.nulldesign.tyme/CoreDataUbiquitySupport/lars~053CB071-18DD-5ED8-B2F0-DD0341B523C7/iCloudStore/2B3578B9-3A28-492B-8C62-BFF7FE7076F3/store/TymeCloud.storedata)"
    );
}
-[PFUbiquitySetupAssistant tryToReplaceLocalStore:withStoreSideLoadedByImporter:](3250): CoreData: Ubiquity:  <PFUbiquitySetupAssistant: 0x100411670>

Error refreshing peer range cache: (null)

storesDidChange: {
    NSPersistentStoreUbiquitousTransitionTypeKey = 4;
    added =     (
        "<NSSQLCore: 0x100410d10> (URL: file:///Users/lars/Library/Containers/de.nulldesign.tyme.osx/Data/Library/Application%20Support/de.nulldesign.tyme/CoreDataUbiquitySupport/lars~053CB071-18DD-5ED8-B2F0-DD0341B523C7/iCloudStore/2B3578B9-3A28-492B-8C62-BFF7FE7076F3/store/TymeCloud.storedata)"
    );
    removed =     (
        "<NSSQLCore: 0x100410d10> (URL: file:///Users/lars/Library/Containers/de.nulldesign.tyme.osx/Data/Library/Application%20Support/de.nulldesign.tyme/CoreDataUbiquitySupport/lars~053CB071-18DD-5ED8-B2F0-DD0341B523C7/iCloudStore/2B3578B9-3A28-492B-8C62-BFF7FE7076F3/store/TymeCloud.storedata)"
    );
}

storesDidChange: {
    added =     (
        "<NSSQLCore: 0x10020cdb0> (URL: file:///Users/lars/Library/Containers/de.nulldesign.tyme.osx/Data/Library/Application%20Support/de.nulldesign.tyme/CoreDataUbiquitySupport/lars~053CB071-18DD-5ED8-B2F0-DD0341B523C7/iCloudStore/2B3578B9-3A28-492B-8C62-BFF7FE7076F3/store/TymeCloud.storedata)"
    );
}

-[PFUbiquitySwitchboardEntryMetadata setUseLocalStorage:](760): CoreData: Ubiquity:  lars~053CB071-18DD-5ED8-B2F0-DD0341B523C7:iCloudStore
Using local storage: 1

After the store has changed, all entities are gone which were not created on this Mac. The other ones remain. Event if it switches to the cloud store:

PFUbiquitySwitchboardEntryMetadata setUseLocalStorage: Using local storage: 0

Only after upgrading all other Mac’s to the latest version of my app, the missing entities are getting synced back again.

The documentation says: Changes to a store are recorded and preserved independently for each model version that is associated with a given NSPersistentStoreUbiquitousContentNameKey. A persistent store configured with a given NSPersistentStoreUbiquitousContentNameKey only syncs data with a store on another device data if the model versions match.

If you migrate a persistent store configured with a NSPersistentStoreUbiquitousContentNameKey option to a new model version, the store’s history of changes originating from the current device will also be migrated and then merged with any other devices configured with that new model version

So I’m wondering, if this is an expected behavior when doing a lightweight migration in iCloud. For my users is definitively not an expected behavior, since their projects vanish until they have upgraded all their devices.

The Core Data stack set up is pretty straight forward:

- (NSPersistentStoreCoordinator *)persistentStoreCoordinator
{
    if(_persistentStoreCoordinator)
    {
        return _persistentStoreCoordinator;
    }

    _persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];

    if(_iCloudConnectionPossible)
    {
        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(storesWillChange:)
                                                     name:NSPersistentStoreCoordinatorStoresWillChangeNotification
                                                   object:_persistentStoreCoordinator];

        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(persistentStoreDidImportUbiquitousContentChanges:)
                                                     name:NSPersistentStoreDidImportUbiquitousContentChangesNotification
                                                   object:_persistentStoreCoordinator];
    }

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(storesDidChange:)
                                                 name:NSPersistentStoreCoordinatorStoresDidChangeNotification
                                               object:_persistentStoreCoordinator];

    NSURL *localStoragePath = [self dataStorePathUseiCloud:_useCloudStorage];

    NSError *error = nil;

    [_persistentStoreCoordinator lock];
    NSPersistentStore *persistentStore = [_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType
                                                                                   configuration:nil
                                                                                             URL:storagePath
                                                                                         options:[self storeOptionsUseiCloud:_useCloudStorage]
                                                                                           error:&error];
    [_persistentStoreCoordinator unlock];
    return _persistentStoreCoordinator;
}

- (NSDictionary *)storeOptionsUseiCloud:(BOOL)useiCloud
{
    NSMutableDictionary *options = [NSMutableDictionary dictionary];
    [options setObject:[NSNumber numberWithBool:YES] forKey:NSMigratePersistentStoresAutomaticallyOption];
    [options setObject:[NSNumber numberWithBool:YES] forKey:NSInferMappingModelAutomaticallyOption];

    if(useiCloud)
    {
        [options setObject:@"iCloudStore" forKey:NSPersistentStoreUbiquitousContentNameKey];
    }

    return options;
}

- (NSManagedObjectContext *)managedObjectContext
{
    if(_managedObjectContext)
    {
        return _managedObjectContext;
    }

    NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator];

    if(coordinator != nil)
    {
        NSManagedObjectContext *moc = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType];
        moc.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy;

        [moc performBlockAndWait:^
        {
            [moc setPersistentStoreCoordinator:coordinator];
        }];

        _managedObjectContext = moc;
    }

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(contextWillSaveNotification:)
                                                 name:NSManagedObjectContextWillSaveNotification
                                               object:_managedObjectContext];

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(mergeChangesAfterDidSaveNotification:)
                                                 name:NSManagedObjectContextDidSaveNotification
                                               object:_managedObjectContext];

    return _managedObjectContext;
}

And the storesWill / DidChange handlers:

- (void)storesWillChange:(NSNotification *)note
{
    NSManagedObjectContext *moc = self.managedObjectContext;
    [moc performBlockAndWait:^
    {
        NSError *error = nil;
        if([moc hasChanges])
        {
            [moc save:&error];
        }

        [moc reset];
    }];
}

- (void)storesDidChange:(NSNotification *)note
{
    // refresh UI, ...
}

Is there any way around this? What’s wrong here?

Upvotes: 4

Views: 1957

Answers (4)

dehlen
dehlen

Reputation: 7389

It is whether broken nor is this unintended behavior. The Apple documentation states that this is the expected result and gives also an explanation.

However, the peer folder name of an App Store version is normally different from that of a non-App Store version (such as a test build installed with Xcode, an Ad Hoc version, or a TestFlight version): for an App Store version, the folder name is determined by data supplied by the App Store, while for a non-App Store version, it is calculated based on the app’s bundle ID.

This means that it will work in your development and production environment as long as you don't mix them up while testing.

Reference: Apple Documentation

Upvotes: -1

lars
lars

Reputation: 249

Meanwhile I received a statement about this issue from Apple Tech Support: Yes, this is the expected behavior. I should file an "enhancement" report, if I expect a better behavior.

Which means: CoreData migration is broken for iCloud. This is not an acceptable experience for a user. How should you be able to tell your customers, that they temporarily loose data until all of their devices are upgraded. If they reinstalled one device or it's broken, the data is lost in the void of iCloud forever.

Upvotes: 3

Duncan Groenewald
Duncan Groenewald

Reputation: 8998

The lightweight migration should work fine, however it can take some time to complete. Below is a log from such a migration. You can see the errors that Core Data shows but all the data exists and some was created by the app on the device and other data was created on other devices. Notice that at one point there is almost 30 seconds of no activity before the switch to the store is finally made (look at time 10:57:51, next activity at 10:58:16).

2014-02-25 10:57:03.213 CoreDataLibraryApp[678:60b] OSCDStackManager.init  called
2014-02-25 10:57:03.342 CoreDataLibraryApp[678:60b] AppDelegate.application:didFinishLaunchingWithOptions: didFinishLaunchingWithOptions called
2014-02-25 10:57:03.344 CoreDataLibraryApp[678:60b] AppDelegate.application:didFinishLaunchingWithOptions:  starting long job (1 seconds) on main thread
2014-02-25 10:57:04.347 CoreDataLibraryApp[678:60b] AppDelegate.application:didFinishLaunchingWithOptions:  finished long job on main thread
2014-02-25 10:57:04.352 CoreDataLibraryApp[678:60b] AppDelegate.application:didFinishLaunchingWithOptions: checkUserICloudPreferenceAndSetupIfNecessary done.
2014-02-25 10:57:04.354 CoreDataLibraryApp[678:60b] DetailViewManager.setDetailViewController:  called
2014-02-25 10:57:04.442 CoreDataLibraryApp[678:60b] DetailViewManager.setDetailViewController:  detailViewController is <OpeningViewController: 0x16d95360>
2014-02-25 10:57:04.444 CoreDataLibraryApp[678:60b] DetailViewManager.setDetailViewController:  openingViewController is (null)
2014-02-25 10:57:04.446 CoreDataLibraryApp[678:60b] DetailViewManager.splitViewController:shouldHideViewController:inOrientation:  called
2014-02-25 10:57:04.447 CoreDataLibraryApp[678:60b] DetailViewManager.splitViewController:shouldHideViewController:inOrientation:  called
2014-02-25 10:57:04.449 CoreDataLibraryApp[678:60b] DetailViewManager.splitViewController:shouldHideViewController:inOrientation:  called
2014-02-25 10:57:04.450 CoreDataLibraryApp[678:60b] AppDelegate.application:didFinishLaunchingWithOptions: didFinishLaunchingWithOptions done.
2014-02-25 10:57:04.492 CoreDataLibraryApp[678:60b] MenuViewController.viewWillAppear:  called
2014-02-25 10:57:04.493 CoreDataLibraryApp[678:60b] DetailViewManager.showOpeningViewController  called
2014-02-25 10:57:04.495 CoreDataLibraryApp[678:60b] DetailViewManager.showOpeningViewController  openingViewController is <OpeningViewController: 0x16d95360>
2014-02-25 10:57:04.632 CoreDataLibraryApp[678:60b] OSCDStackManager.performChecks checkUserICloudPreferenceAndSetupIfNecessary called
2014-02-25 10:57:04.636 CoreDataLibraryApp[678:60b] OSCDStackManager.showBackgroundTaskActive  _job_counter is 1
2014-02-25 10:57:04.643 CoreDataLibraryApp[678:60b] OSCDStackManager.backupCurrentStore  called
2014-02-25 10:57:04.659 CoreDataLibraryApp[678:60b] OSCDStackManager.backupCurrentStore  backup not required
2014-02-25 10:57:04.779 CoreDataLibraryApp[678:60b] OSCDStackManager.performChecks  ubiquityIdentityToken is <c1fb12f1 f34ca983 5b43956f c11118e3 0a5e1bb8>
2014-02-25 10:57:04.916 CoreDataLibraryApp[678:60b] OSCDStackManager.performChecks  iCloud container is file:///private/var/mobile/Library/Mobile%20Documents/HHWT75NS6T~au~com~ossh~CoreDataLibraryApp/CoreData/
2014-02-25 10:57:04.917 CoreDataLibraryApp[678:60b] OSCDStackManager.createFileQuery  called.
2014-02-25 10:57:04.918 CoreDataLibraryApp[678:60b] OSCDStackManager.createFileQuery   Creating metadata query
2014-02-25 10:57:04.921 CoreDataLibraryApp[678:60b] OSCDStackManager.createFileQuery   starting iCloud metadata query
2014-02-25 10:57:04.922 CoreDataLibraryApp[678:60b] OSCDStackManager.createFileQuery   query started
2014-02-25 10:57:04.923 CoreDataLibraryApp[678:60b] OSCDStackManager.performChecks  iCloud is enabled
2014-02-25 10:57:04.925 CoreDataLibraryApp[678:60b] OSCDStackManager.performChecks  User preference for au.com.ossh.CoreDataLibraryApp.UseICloudStorage is YES
2014-02-25 10:57:04.927 CoreDataLibraryApp[678:60b] OSCDStackManager.performChecks  User selected iCloud
2014-02-25 10:57:04.928 CoreDataLibraryApp[678:60b] OSCDStackManager.performChecks  iCloud is active
2014-02-25 10:57:04.929 CoreDataLibraryApp[678:60b] OSCDStackManager.performChecks  userICloudChoiceSet is set
2014-02-25 10:57:04.930 CoreDataLibraryApp[678:60b] OSCDStackManager.performChecks  userICloudChoice is YES
2014-02-25 10:57:04.931 CoreDataLibraryApp[678:60b] OSCDStackManager.setIsCloudEnabled: setIsCloudEnabled:YES called
2014-02-25 10:57:04.939 CoreDataLibraryApp[678:4303] OSCDStackManager.migrateFilesIfRequired migrateFilesIfRequired called...
2014-02-25 10:57:04.955 CoreDataLibraryApp[678:4303] OSCDStackManager.migrateFilesIfRequired  iCloud has been enabled so migrate local files to iCloud if they exist
2014-02-25 10:57:04.956 CoreDataLibraryApp[678:4303] OSCDStackManager.localStoreExists localStoreExists called
2014-02-25 10:57:04.959 CoreDataLibraryApp[678:4303] OSCDStackManager.localStoreExists   localStoreURL is /var/mobile/Applications/2B6EA87A-05F1-4E38-A776-1CF74379B65A/Documents/persistentStore
2014-02-25 10:57:04.960 CoreDataLibraryApp[678:4303] OSCDStackManager.localStoreExists   localStoreURL does not exist
2014-02-25 10:57:04.962 CoreDataLibraryApp[678:4303] OSCDStackManager.migrateFilesIfRequired  No local store exists
2014-02-25 10:57:04.964 CoreDataLibraryApp[678:4303] OSCDStackManager.openPersistentStore   openPersistentStore called... XXXXXXXXXX XXX XXX XX XX X X
2014-02-25 10:57:04.979 CoreDataLibraryApp[678:4303] OSCDStackManager.openPersistentStore  storeURL is file:///var/mobile/Applications/2B6EA87A-05F1-4E38-A776-1CF74379B65A/Documents/persistentStore_ICLOUD
2014-02-25 10:57:04.980 CoreDataLibraryApp[678:4303] OSCDStackManager.storeExists  called
2014-02-25 10:57:04.988 CoreDataLibraryApp[678:4303] OSCDStackManager.iCloudStoreExists iCloudStoreExists called
2014-02-25 10:57:04.990 CoreDataLibraryApp[678:4303] OSCDStackManager.iCloudStoreExists  Checking if file exists in local ubiquity container
2014-02-25 10:57:05.162 CoreDataLibraryApp[678:3707] OSCDStackManager.listAllICloudDocs   iCloudDirectory is file:///private/var/mobile/Library/Mobile%20Documents/HHWT75NS6T~au~com~ossh~CoreDataLibraryApp/CoreData/
2014-02-25 10:57:05.164 CoreDataLibraryApp[678:3707] OSCDStackManager.listAllICloudDocs    
2014-02-25 10:57:05.166 CoreDataLibraryApp[678:3707] OSCDStackManager.listAllICloudDocs   ICLOUD DOCUMENTS (1)
2014-02-25 10:57:05.167 CoreDataLibraryApp[678:3707] OSCDStackManager.listAllICloudDocs   =====================
2014-02-25 10:57:05.168 CoreDataLibraryApp[678:3707] OSCDStackManager.listAllICloudDocs   persistentStore_ICLOUD
2014-02-25 10:57:05.169 CoreDataLibraryApp[678:3707] OSCDStackManager.listAllICloudDocs    
2014-02-25 10:57:05.386 CoreDataLibraryApp[678:4303] OSCDStackManager.iCloudStoreExists   icloudStoreURL is /private/var/mobile/Library/Mobile Documents/HHWT75NS6T~au~com~ossh~CoreDataLibraryApp/CoreData/persistentStore_ICLOUD
2014-02-25 10:57:05.531 CoreDataLibraryApp[678:4303] OSCDStackManager.iCloudStoreExists   icloudStoreURL exists
2014-02-25 10:57:05.533 CoreDataLibraryApp[678:4303] OSCDStackManager.iCloudStoreExists  Now checking if file exists in iCloud (not downloaded yet perhaps)
2014-02-25 10:57:05.534 CoreDataLibraryApp[678:4303] OSCDStackManager.doesICloudFileExist  called
2014-02-25 10:57:05.537 CoreDataLibraryApp[678:60b] OSCDStackManager.createFileQuery  called.
2014-02-25 10:57:05.539 CoreDataLibraryApp[678:60b] OSCDStackManager.createFileQuery   Creating metadata query
2014-02-25 10:57:05.540 CoreDataLibraryApp[678:60b] OSCDStackManager.createFileQuery   starting iCloud metadata query
2014-02-25 10:57:05.541 CoreDataLibraryApp[678:60b] OSCDStackManager.createFileQuery   query started
2014-02-25 10:57:05.543 CoreDataLibraryApp[678:4303] OSCDStackManager.doesICloudFileExist  has not checked iCloud yet, waiting
2014-02-25 10:57:05.974 CoreDataLibraryApp[678:60b] OSCDStackManager.fileListReceived  called.
2014-02-25 10:57:05.976 CoreDataLibraryApp[678:1803] OSCDStackManager.processFiles  called.
2014-02-25 10:57:05.977 CoreDataLibraryApp[678:1803] OSCDStackManager.processFiles   querystopped
2014-02-25 10:57:06.040 CoreDataLibraryApp[678:1803] OSCDStackManager.processFiles  all files CURRENT
2014-02-25 10:57:06.041 CoreDataLibraryApp[678:1803] OSCDStackManager.processFiles  iCloud file exists
2014-02-25 10:57:06.545 CoreDataLibraryApp[678:4303] OSCDStackManager.doesICloudFileExist  has checked iCloud, file exists
2014-02-25 10:57:06.547 CoreDataLibraryApp[678:4303] OSCDStackManager.iCloudStoreExists   icloud store exists
2014-02-25 10:57:06.549 CoreDataLibraryApp[678:4303] OSCDStackManager.storeExists   iCloudStoreExists returned YES
2014-02-25 10:57:06.551 CoreDataLibraryApp[678:4303] OSCDStackManager.openPersistentStore  store Options are {
    NSInferMappingModelAutomaticallyOption = 1;
    NSMigratePersistentStoresAutomaticallyOption = 1;
    NSPersistentStoreUbiquitousContentNameKey = "persistentStore_ICLOUD";
    NSSQLitePragmasOption =     {
        "journal_mode" = DELETE;
    };
}
2014-02-25 10:57:06.552 CoreDataLibraryApp[678:4303] OSCDStackManager.openPersistentStore   addPersistentStoreWithType about to be called... 
2014-02-25 10:57:06.554 CoreDataLibraryApp[678:4303] OSCDStackManager.snooze:   sleeping for 1 seconds... 
2014-02-25 10:57:07.556 CoreDataLibraryApp[678:4303] OSCDStackManager.snooze:   done sleeping.
2014-02-25 10:57:08.686 CoreDataLibraryApp[678:4303] OSCDStackManager.storesDidChange: storesDidChange called - >>>>>>>>>>>>>>>>>>>>>>>>>>>>
2014-02-25 10:57:08.687 CoreDataLibraryApp[678:4303] OSCDStackManager.storesDidChange:  userInfo is {
    added =     (
        "<NSSQLCore: 0x16d40640> (URL: file:///var/mobile/Applications/2B6EA87A-05F1-4E38-A776-1CF74379B65A/Documents/CoreDataUbiquitySupport/mobile~A3BF465A-15C7-46F2-8C68-AC8F49FD15AB/persistentStore_ICLOUD/D7446340-186B-4EDB-A5C9-43006892D532/store/persistentStore_ICLOUD)"
    );
}
2014-02-25 10:57:08.689 CoreDataLibraryApp[678:4303] OSCDStackManager.storesDidChange:  transition type is (null)
2014-02-25 10:57:08.690 CoreDataLibraryApp[678:60b] OSCDStackManager.createTimer  called
2014-02-25 10:57:08.691 CoreDataLibraryApp[678:60b] OSCDStackManager.showBackgroundTaskActive  _job_counter is 2
2014-02-25 10:57:08.720 CoreDataLibraryApp[678:4303] -[PFUbiquitySwitchboardEntryMetadata setUseLocalStorage:](771): CoreData: Ubiquity:  mobile~A3BF465A-15C7-46F2-8C68-AC8F49FD15AB:persistentStore_ICLOUD
Using local storage: 1
2014-02-25 10:57:08.729 CoreDataLibraryApp[678:4303] OSCDStackManager.openPersistentStore   addPersistentStoreWithType completed successfully... 
2014-02-25 10:57:08.732 CoreDataLibraryApp[678:4303] OSCDStackManager.loadSeedDataIfRequired  called
2014-02-25 10:57:08.733 CoreDataLibraryApp[678:4303] OSCDStackManager.loadSeedDataIfRequired  Do not load seed data
2014-02-25 10:57:08.735 CoreDataLibraryApp[678:4303] OSCDStackManager.createTimer  called
2014-02-25 10:57:08.738 CoreDataLibraryApp[678:4303] OSCDStackManager.showBackgroundTaskInactive  _job_counter is 1
2014-02-25 10:57:09.739 CoreDataLibraryApp[678:60b] OSCDStackManager.notifyOfCoreDataUpdates notifyOfCoreDataUpdates called
2014-02-25 10:57:09.742 CoreDataLibraryApp[678:60b] OSCDStackManager.showBackgroundTaskInactive  _job_counter is 0
2014-02-25 10:57:17.665 CoreDataLibraryApp[678:60b] OSCDStackManager.fileListReceived  called.
2014-02-25 10:57:17.667 CoreDataLibraryApp[678:4303] OSCDStackManager.processFiles  called.
2014-02-25 10:57:17.669 CoreDataLibraryApp[678:4303] OSCDStackManager.processFiles   querystopped
2014-02-25 10:57:17.681 CoreDataLibraryApp[678:4303] OSCDStackManager.processFiles  keep running query because not all files CURRENT
2014-02-25 10:57:17.682 CoreDataLibraryApp[678:4303] OSCDStackManager.showBackgroundTaskActive  _job_counter is 1
2014-02-25 10:57:22.038 CoreDataLibraryApp[678:60b] OSCDStackManager.fileListReceived  called.
2014-02-25 10:57:22.040 CoreDataLibraryApp[678:4303] OSCDStackManager.processFiles  called.
2014-02-25 10:57:22.042 CoreDataLibraryApp[678:4303] OSCDStackManager.processFiles   querystopped
2014-02-25 10:57:22.053 CoreDataLibraryApp[678:4303] OSCDStackManager.processFiles  keep running query because not all files CURRENT
2014-02-25 10:57:23.916 CoreDataLibraryApp[678:60b] OSCDStackManager.fileListReceived  called.
2014-02-25 10:57:23.918 CoreDataLibraryApp[678:4303] OSCDStackManager.processFiles  called.
2014-02-25 10:57:23.920 CoreDataLibraryApp[678:4303] OSCDStackManager.processFiles   querystopped
2014-02-25 10:57:23.931 CoreDataLibraryApp[678:4303] OSCDStackManager.processFiles  all files CURRENT
2014-02-25 10:57:23.932 CoreDataLibraryApp[678:4303] OSCDStackManager.showBackgroundTaskInactive  _job_counter is 0
2014-02-25 10:57:23.933 CoreDataLibraryApp[678:4303] OSCDStackManager.processFiles  iCloud file exists
2014-02-25 10:57:43.975 CoreDataLibraryApp[678:3707] OSCDStackManager.storesWillChange: storesWillChange called - >>>>>>>>>>>>>>>>>>>>>>>>>>>>
2014-02-25 10:57:43.976 CoreDataLibraryApp[678:3707] OSCDStackManager.storesWillChange:  transition type is 4
2014-02-25 10:57:43.978 CoreDataLibraryApp[678:3707] OSCDStackManager.storesWillChange:  transition type is NSPersistentStoreUbiquitousTransitionTypeInitialImportCompleted
2014-02-25 10:57:43.980 CoreDataLibraryApp[678:3707] OSCDStackManager.storesWillChange:  added stores are (
    "<NSSQLCore: 0x16d40640> (URL: file:///var/mobile/Applications/2B6EA87A-05F1-4E38-A776-1CF74379B65A/Documents/CoreDataUbiquitySupport/mobile~A3BF465A-15C7-46F2-8C68-AC8F49FD15AB/persistentStore_ICLOUD/D7446340-186B-4EDB-A5C9-43006892D532/store/persistentStore_ICLOUD)"
)
2014-02-25 10:57:43.982 CoreDataLibraryApp[678:3707] OSCDStackManager.storesWillChange:  removed stores are (
    "<NSSQLCore: 0x16d40640> (URL: file:///var/mobile/Applications/2B6EA87A-05F1-4E38-A776-1CF74379B65A/Documents/CoreDataUbiquitySupport/mobile~A3BF465A-15C7-46F2-8C68-AC8F49FD15AB/persistentStore_ICLOUD/D7446340-186B-4EDB-A5C9-43006892D532/store/persistentStore_ICLOUD)"
)
2014-02-25 10:57:43.983 CoreDataLibraryApp[678:3707] OSCDStackManager.storesWillChange:  changed stores are (null)
2014-02-25 10:57:43.984 CoreDataLibraryApp[678:60b] OSCDStackManager.persistentStoreCoordinator persistentStoreCoordinator called
2014-02-25 10:57:44.055 CoreDataLibraryApp[678:3707] OSCDStackManager.storesDidChange: storesDidChange called - >>>>>>>>>>>>>>>>>>>>>>>>>>>>
2014-02-25 10:57:44.056 CoreDataLibraryApp[678:3707] OSCDStackManager.storesDidChange:  userInfo is {
    NSPersistentStoreUbiquitousTransitionTypeKey = 4;
    added =     (
        "<NSSQLCore: 0x16d40640> (URL: file:///var/mobile/Applications/2B6EA87A-05F1-4E38-A776-1CF74379B65A/Documents/CoreDataUbiquitySupport/mobile~A3BF465A-15C7-46F2-8C68-AC8F49FD15AB/persistentStore_ICLOUD/D7446340-186B-4EDB-A5C9-43006892D532/store/persistentStore_ICLOUD)"
    );
    removed =     (
        "<NSSQLCore: 0x16d40640> (URL: file:///var/mobile/Applications/2B6EA87A-05F1-4E38-A776-1CF74379B65A/Documents/CoreDataUbiquitySupport/mobile~A3BF465A-15C7-46F2-8C68-AC8F49FD15AB/persistentStore_ICLOUD/D7446340-186B-4EDB-A5C9-43006892D532/store/persistentStore_ICLOUD)"
    );
}
2014-02-25 10:57:44.058 CoreDataLibraryApp[678:3707] OSCDStackManager.storesDidChange:  transition type is 4
2014-02-25 10:57:44.060 CoreDataLibraryApp[678:3707] OSCDStackManager.storesDidChange:  transition type is NSPersistentStoreUbiquitousTransitionTypeInitialImportCompleted
2014-02-25 10:57:44.061 CoreDataLibraryApp[678:60b] OSCDStackManager.createTimer  called
2014-02-25 10:57:44.063 CoreDataLibraryApp[678:60b] OSCDStackManager.showBackgroundTaskActive  _job_counter is 1
2014-02-25 10:57:44.376 CoreDataLibraryApp[678:60b] OSCDStackManager.fileListReceived  called.
2014-02-25 10:57:44.378 CoreDataLibraryApp[678:4b0f] OSCDStackManager.processFiles  called.
2014-02-25 10:57:44.380 CoreDataLibraryApp[678:4b0f] OSCDStackManager.processFiles   querystopped
2014-02-25 10:57:44.394 CoreDataLibraryApp[678:4b0f] OSCDStackManager.processFiles  keep running query because not all files CURRENT
2014-02-25 10:57:44.395 CoreDataLibraryApp[678:4b0f] OSCDStackManager.showBackgroundTaskActive  _job_counter is 2
2014-02-25 10:57:45.064 CoreDataLibraryApp[678:60b] OSCDStackManager.notifyOfCoreDataUpdates notifyOfCoreDataUpdates called
2014-02-25 10:57:45.067 CoreDataLibraryApp[678:60b] OSCDStackManager.showBackgroundTaskInactive  _job_counter is 1
2014-02-25 10:57:47.641 CoreDataLibraryApp[678:60b] OSCDStackManager.fileListReceived  called.
2014-02-25 10:57:47.644 CoreDataLibraryApp[678:4b0f] OSCDStackManager.processFiles  called.
2014-02-25 10:57:47.645 CoreDataLibraryApp[678:4b0f] OSCDStackManager.processFiles   querystopped
2014-02-25 10:57:47.657 CoreDataLibraryApp[678:4b0f] OSCDStackManager.processFiles  keep running query because not all files CURRENT
2014-02-25 10:57:51.002 CoreDataLibraryApp[678:60b] OSCDStackManager.fileListReceived  called.
2014-02-25 10:57:51.004 CoreDataLibraryApp[678:4b0f] OSCDStackManager.processFiles  called.
2014-02-25 10:57:51.005 CoreDataLibraryApp[678:4b0f] OSCDStackManager.processFiles   querystopped
2014-02-25 10:57:51.020 CoreDataLibraryApp[678:4b0f] OSCDStackManager.processFiles  all files CURRENT
2014-02-25 10:57:51.022 CoreDataLibraryApp[678:4b0f] OSCDStackManager.showBackgroundTaskInactive  _job_counter is 0
2014-02-25 10:57:51.023 CoreDataLibraryApp[678:4b0f] OSCDStackManager.processFiles  iCloud file exists
2014-02-25 10:58:16.108 CoreDataLibraryApp[678:3707] -[PFUbiquitySafeSaveFile waitForFileToUpload:](299): CoreData: Ubiquity:  <PFUbiquityBaseline: 0x16e1edc0>(0)
    permanentLocation: <PFUbiquityLocation: 0x16e1eea0>: /var/mobile/Library/Mobile Documents/HHWT75NS6T~au~com~ossh~CoreDataLibraryApp/CoreData/persistentStore_ICLOUD/.baseline/persistentStore_ICLOUD/cwloRsUoKpzgKGCNoi2z46q21XiaQQ4g8n2tM6pS~Po=/baseline.zip
    safeLocation: <PFUbiquityLocation: 0x16e1eed0>: /var/mobile/Library/Mobile Documents/HHWT75NS6T~au~com~ossh~CoreDataLibraryApp/CoreData/persistentStore_ICLOUD/.baseline/persistentStore_ICLOUD/cwloRsUoKpzgKGCNoi2z46q21XiaQQ4g8n2tM6pS~Po=/mobile~A3BF465A-15C7-46F2-8C68-AC8F49FD15AB
    currentLocation: <PFUbiquityLocation: 0x16e1eed0>: /var/mobile/Library/Mobile Documents/HHWT75NS6T~au~com~ossh~CoreDataLibraryApp/CoreData/persistentStore_ICLOUD/.baseline/persistentStore_ICLOUD/cwloRsUoKpzgKGCNoi2z46q21XiaQQ4g8n2tM6pS~Po=/mobile~A3BF465A-15C7-46F2-8C68-AC8F49FD15AB

    storeName: persistentStore_ICLOUD
    modelVersionHash: cwloRsUoKpzgKGCNoi2z46q21XiaQQ4g8n2tM6pS~Po=
    baselineArchiveLocation: <PFUbiquityLocation: 0x16e1eea0>: /var/mobile/Library/Mobile Documents/HHWT75NS6T~au~com~ossh~CoreDataLibraryApp/CoreData/persistentStore_ICLOUD/.baseline/persistentStore_ICLOUD/cwloRsUoKpzgKGCNoi2z46q21XiaQQ4g8n2tM6pS~Po=/baseline.zip

Safe save failed for file, error: Error Domain=NSCocoaErrorDomain Code=260 "The operation couldn’t be completed. (Cocoa error 260 - Request for item properties on non-existent item.)" UserInfo=0x16d56b60 {NSDescription=Request for item properties on non-existent item.}
2014-02-25 10:58:16.116 CoreDataLibraryApp[678:3707] -[PFUbiquitySetupAssistant finishSetupForStore:error:](1012): CoreData: Ubiquity:  <PFUbiquitySetupAssistant: 0x16d45940>
    options: {
    NSInferMappingModelAutomaticallyOption = 1;
    NSMigratePersistentStoresAutomaticallyOption = 1;
    NSPersistentStoreUbiquitousContentNameKey = "persistentStore_ICLOUD";
    NSSQLitePragmasOption =     {
        "journal_mode" = DELETE;
    };
}
    psc: <NSPersistentStoreCoordinator: 0x16ea2570>
    store: <NSSQLCore: 0x16d40640> (URL: file:///var/mobile/Applications/2B6EA87A-05F1-4E38-A776-1CF74379B65A/Documents/CoreDataUbiquitySupport/mobile~A3BF465A-15C7-46F2-8C68-AC8F49FD15AB/persistentStore_ICLOUD/D7446340-186B-4EDB-A5C9-43006892D532/store/persistentStore_ICLOUD)
    storeURL: file:///var/mobile/Applications/2B6EA87A-05F1-4E38-A776-1CF74379B65A/Documents/CoreDataUbiquitySupport/mobile~A3BF465A-15C7-46F2-8C68-AC8F49FD15AB/persistentStore_ICLOUD/D7446340-186B-4EDB-A5C9-43006892D532/store/persistentStore_ICLOUD
    actualStoreURL: file:///var/mobile/Applications/2B6EA87A-05F1-4E38-A776-1CF74379B65A/Documents/CoreDataUbiquitySupport/mobile~A3BF465A-15C7-46F2-8C68-AC8F49FD15AB/persistentStore_ICLOUD/D7446340-186B-4EDB-A5C9-43006892D532/store/persistentStore_ICLOUD
    storeMetadata: {
    NSPersistenceFrameworkVersion = 479;
    NSStoreModelVersionHashes =     {
        Company = <e4d136d3 2e3c702a d137c31b d9b4fafa 4450aeba 09b59e09 7b715b06 ef379020>;
        Contact = <7f35a0c9 6c3f490c 98bb4276 20b39a2b 86d4384f 301d7228 8be03a8d 30d6b0ec>;
        Deliverable = <27faefa4 8ca257fc 9ad0ebe5 18ec883b 862c87cc 5dce86c8 8ef4f514 2ab8407e>;
        Person = <d6cf6811 68922c51 9a93aa08 7fc172fd 86c710e5 b79ed8f2 d9b941f3 d9eadc1e>;
        Program = <15879af6 ccb62dfb fff56d7e bfe6d087 9a9422d5 b839c887 908f84c7 d7bccaa1>;
        Project = <0dd03984 c7f0e76c a1a0b703 34c5b7bb e5a71ccc a81d2273 a3ee6462 cd4c15ed>;
        ProjectType = <4f1f3258 e877298f 88055237 fb9832c8 2c40bb4d 0c604562 8d47b770 7bda9f09>;
    };

    NSStoreModelVersionHashesVersion = 3;
    NSStoreModelVersionIdentifiers =     (
        ""
    );
    NSStoreType = SQLite;
    NSStoreUUID = "FF808963-A275-4631-83D3-3BC991147555";
    PFUbiquitySetupContainerIdentifierKey = "D7446340-186B-4EDB-A5C9-43006892D532";
    PFUbiquitySetupOriginalStoreURLAbsoluteStringKey = "file:///var/mobile/Applications/2B6EA87A-05F1-4E38-A776-1CF74379B65A/Documents/persistentStore_ICLOUD";
    PFUbiquitySetupPreviousModelVersionHashKey = "xuH12bxbPI5FO_uboaBoP4EUS~raVWx0ga0Ia6jerHg=";
    "_NSAutoVacuumLevel" = 2;
    "com.apple.coredata.ubiquity.baseline.timestamp" = 1393285820;
    "com.apple.coredata.ubiquity.ubiquitized" = 1;
}
    storeKV: <PFUbiquityKnowledgeVector: 0x16f8f100> (duncangroenewald~AABC628E-9D5E-58F7-9B8D-0BC724C6D0C8:101:mobile~A3BF465A-15C7-46F2-8C68-AC8F49FD15AB:1)
    storeFileExists: 1
    storeFileIsReadOnly: 0
    ubiquityEnabled: 1
    ubiquityIdentityToken: <c1fb12f1 f34ca983 5b43956f c11118e3 0a5e1bb8>
    ubiquityRootURL: file:///private/var/mobile/Library/Mobile%20Documents/HHWT75NS6T~au~com~ossh~CoreDataLibraryApp/CoreData/persistentStore_ICLOUD/
    ubiquityRootSubpath: (null)
    ubiquityName: persistentStore_ICLOUD
    ubiquityContainerIdentifier: (null)
    localPeerID: mobile~A3BF465A-15C7-46F2-8C68-AC8F49FD15AB
    modelVersionHash: cwloRsUoKpzgKGCNoi2z46q21XiaQQ4g8n2tM6pS~Po=
    ubiquityRootLocation: <PFUbiquityLocation: 0x16eb0db0>: /var/mobile/Library/Mobile Documents/HHWT75NS6T~au~com~ossh~CoreDataLibraryApp/CoreData/persistentStore_ICLOUD
    localRootLocation: <PFUbiquityLocation: 0x16d4f3e0>: /var/mobile/Applications/2B6EA87A-05F1-4E38-A776-1CF74379B65A/Documents/CoreDataUbiquitySupport/mobile~A3BF465A-15C7-46F2-8C68-AC8F49FD15AB/persistentStore_ICLOUD/D7446340-186B-4EDB-A5C9-43006892D532/container
    metaKV: <PFUbiquityKnowledgeVector: 0x16e898e0> (duncangroenewald~AABC628E-9D5E-58F7-9B8D-0BC724C6D0C8:101)
    baseline: <PFUbiquityBaseline: 0x16e1edc0>(0)
    permanentLocation: <PFUbiquityLocation: 0x16e1eea0>: /var/mobile/Library/Mobile Documents/HHWT75NS6T~au~com~ossh~CoreDataLibraryApp/CoreData/persistentStore_ICLOUD/.baseline/persistentStore_ICLOUD/cwloRsUoKpzgKGCNoi2z46q21XiaQQ4g8n2tM6pS~Po=/baseline.zip
    safeLocation: <PFUbiquityLocation: 0x16e1eed0>: /var/mobile/Library/Mobile Documents/HHWT75NS6T~au~com~ossh~CoreDataLibraryApp/CoreData/persistentStore_ICLOUD/.baseline/persistentStore_ICLOUD/cwloRsUoKpzgKGCNoi2z46q21XiaQQ4g8n2tM6pS~Po=/mobile~A3BF465A-15C7-46F2-8C68-AC8F49FD15AB
    currentLocation: <PFUbiquityLocation: 0x16e1eed0>: /var/mobile/Library/Mobile Documents/HHWT75NS6T~au~com~ossh~CoreDataLibraryApp/CoreData/persistentStore_ICLOUD/.baseline/persistentStore_ICLOUD/cwloRsUoKpzgKGCNoi2z46q21XiaQQ4g8n2tM6pS~Po=/mobile~A3BF465A-15C7-46F2-8C68-AC8F49FD15AB

    storeName: persistentStore_ICLOUD
    modelVersionHash: cwloRsUoKpzgKGCNoi2z46q21XiaQQ4g8n2tM6pS~Po=
    baselineArchiveLocation: <PFUbiquityLocation: 0x16e1eea0>: /var/mobile/Library/Mobile Documents/HHWT75NS6T~au~com~ossh~CoreDataLibraryApp/CoreData/persistentStore_ICLOUD/.baseline/persistentStore_ICLOUD/cwloRsUoKpzgKGCNoi2z46q21XiaQQ4g8n2tM6pS~Po=/baseline.zip

    baselineFileExists: 1
    hasUploadingBaseline: 1
    monitorBaslineUploadAsync: 0
    didBaselineCopy: 1
    baselineKV: <PFUbiquityKnowledgeVector: 0x16f1dde0> (duncangroenewald~AABC628E-9D5E-58F7-9B8D-0BC724C6D0C8:101:mobile~A3BF465A-15C7-46F2-8C68-AC8F49FD15AB:1)
    hasStoreMetadataFile: 1
    hasStoreMetadataEntry: 1
    hasContainerUUID: 1
    hasContainerUUIDInStore: 1
    needsMetadataRecovery: 0
    localPeerReceipt: <PFUbiquityPeerReceipt: 0x16f19b70>(0)
    permanentLocation: <PFUbiquityLocation: 0x16f17d30>: /var/mobile/Library/Mobile Documents/HHWT75NS6T~au~com~ossh~CoreDataLibraryApp/CoreData/persistentStore_ICLOUD/mobile~A3BF465A-15C7-46F2-8C68-AC8F49FD15AB/persistentStore_ICLOUD/cwloRsUoKpzgKGCNoi2z46q21XiaQQ4g8n2tM6pS~Po=/receipt.0.cdt
    safeLocation: <PFUbiquityLocation: 0x16d57780>: /var/mobile/Library/Mobile Documents/HHWT75NS6T~au~com~ossh~CoreDataLibraryApp/CoreData/persistentStore_ICLOUD/mobile~A3BF465A-15C7-46F2-8C68-AC8F49FD15AB/persistentStore_ICLOUD/cwloRsUoKpzgKGCNoi2z46q21XiaQQ4g8n2tM6pS~Po=/mobile~A3BF465A-15C7-46F2-8C68-AC8F49FD15AB.0.cdt
    currentLocation: <PFUbiquityLocation: 0x16f17d30>: /var/mobile/Library/Mobile Documents/HHWT75NS6T~au~com~ossh~CoreDataLibraryApp/CoreData/persistentStore_ICLOUD/mobile~A3BF465A-15C7-46F2-8C68-AC8F49FD15AB/persistentStore_ICLOUD/cwloRsUoKpzgKGCNoi2z46q21XiaQQ4g8n2tM6pS~Po=/receipt.0.cdt

    kv: <PFUbiquityKnowledgeVector: 0x16dafa90> (duncangroenewald~AABC628E-9D5E-58F7-9B8D-0BC724C6D0C8:101:mobile~A3BF465A-15C7-46F2-8C68-AC8F49FD15AB:1)

    receiptKV: <PFUbiquityKnowledgeVector: 0x16d199a0> ()
    containerIdentifier: <PFUbiquityContainerIdentifier: 0x16da1a20>: <PFUbiquityLocation: 0x16f64080>: /var/mobile/Library/Mobile Documents/HHWT75NS6T~au~com~ossh~CoreDataLibraryApp/CoreData/persistentStore_ICLOUD/.cdmetadata/metadata.nosync/mobile~A3BF465A-15C7-46F2-8C68-AC8F49FD15AB/persistentStore_ICLOUD/D7446340-186B-4EDB-A5C9-43006892D532.cid
    preStoreContainerUUID: D7446340-186B-4EDB-A5C9-43006892D532
    usedExistingUUIDMapping: 1
    hasLocalTransactionLogs: 1
    votedOffIsland: 0
    reapUbiquitousLogs: 0
    respondToBaselineRoll: 0
    hasMigrationOptions: 1
    didMigrateBaseline: 1
    storeWasMigrated: 0
    replayLogsSynchronously: 1
    useLocalAccount: 0
    abortSetup: 0
    gotExportNotification: 0
Setup failed after waiting for the baseline file to upload.
Error Domain=NSCocoaErrorDomain Code=260 "The operation couldn’t be completed. (Cocoa error 260 - Request for item properties on non-existent item.)" UserInfo=0x16d56b60 {NSDescription=Request for item properties on non-existent item.}
2014-02-25 10:58:16.129 CoreDataLibraryApp[678:3707] -[PFUbiquitySwitchboardEntryMetadata setUseLocalStorage:](771): CoreData: Ubiquity:  mobile~A3BF465A-15C7-46F2-8C68-AC8F49FD15AB:persistentStore_ICLOUD
Using local storage: 0
2014-02-25 10:58:16.167 CoreDataLibraryApp[678:3707] -[PFUbiquitySetupAssistant finishSetupWithRetry:](822): CoreData: Ubiquity:  <PFUbiquitySetupAssistant: 0x16d45940>: Retrying after delay: 60
Error Domain=NSCocoaErrorDomain Code=260 "The operation couldn’t be completed. (Cocoa error 260 - Request for item properties on non-existent item.)" UserInfo=0x16d56b60 {NSDescription=Request for item properties on non-existent item.}
2014-02-25 10:58:24.819 CoreDataLibraryApp[678:60b] OSCDStackManager.fileListReceived  called.
2014-02-25 10:58:24.820 CoreDataLibraryApp[678:5c1f] OSCDStackManager.processFiles  called.
2014-02-25 10:58:24.821 CoreDataLibraryApp[678:5c1f] OSCDStackManager.processFiles   querystopped
2014-02-25 10:58:24.836 CoreDataLibraryApp[678:5c1f] OSCDStackManager.processFiles  all files CURRENT
2014-02-25 10:58:24.838 CoreDataLibraryApp[678:5c1f] OSCDStackManager.processFiles  iCloud file exists

Upvotes: 1

Drew McCormack
Drew McCormack

Reputation: 3592

I doubt very much that this is the intended behavior. As far as I understand it, your updated app should keep its data, but will not see data from older versions until they update.

It seems the original error was in the Librarian, which I think is mainly just responsible for transferring files back and forth from the cloud. Perhaps an error there somehow triggered your app to retreat to its fallback store, with no data.

It may be worth trying the whole thing again, and seeing if the same outcome occurs. It may have just been a one off due to a failed download, and perhaps it may have recovered after a while.

This sort of thing is why I never shipped with Apple's iCloud+Core Data sync – not for lack of trying – and still don't trust it now. How can you trust a persistence framework that drops data or changes it in unexpected ways (e.g. loses relationships), and where none of that is documented, and you don't have the source code?

Apple's solution couples the Core Data stack far too tightly to its sync engine. They made that mistake very early, and now they can't back out. They just keep digging themselves deeper and deeper. Fallback stores are a classic example. Now they are changing stores out from under you.

The correct solution, as adopted in open source and commercial offerings like Wasabi Sync, TICDS, and Ensembles, is to have a decoupled sync framework. If the sync engine fails, it should not bring down your Core Data stack in any way. It should sure as hell not revert to an empty store for no good reason.

I think the way Ensembles solves it is the way Apple should have done it (Disclosure: I develop Ensembles). The Core Data stack is setup just like any stack, with no 'knowledge' of sync. The sync framework monitors saves to the persistent store, and merges changes from other devices via a background context. At no point are you ever forced to tear down your stack, change persistent stores, or migrate data. You treat the stack almost as if it was a standard, non-syncing stack.

Upvotes: 1

Related Questions