ICloud does not insert previous version data if I update the test version on the appstore version


My application using coredata with iCloud.
My version of the application is available in version 1.0 for iTunes.

I added a new version of the model in coredata, added 2 fields in my coredata object.

iCloud version 2.0 with coredata works fine if I install the binary from xCode.
Working script
Install the xcode archive of form v1.0.
Enter some data into the
Update to version 2.0 application from the xcode archive.
Everything that works with icloud.

Borken script
Download version 1.0 from the app store.
Enter some details.
Update v2.0 from the xcode archive, data not available in iCloud.

I don’t know what I am missing. But there is something wrong with the itunes version to archive the version update.

+4
1

CoreData, persistentStoreCoordinator:

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

    NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"your_coredata_database.sqlite"];

    NSError *error = nil;
    _persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
    if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:@{NSMigratePersistentStoresAutomaticallyOption:@YES, NSInferMappingModelAutomaticallyOption:@YES} error:&error]) {

    NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
    abort();
}

coredata, .

0

Source: https://habr.com/ru/post/1544855/


All Articles