I have seen a slick method for upgrading user data from one iOS app to another across the sandboxes; the destination app registers as a special URL handler and the origin app base64-encodes an entire file and sends it as a plaintext string to the specialized URL, which the destination app decodes and saves to filesystem.
Is it possible to encode the origin’s managed object context & send that & have the destination parse that into it’s managed object context? That is, instead of over-writing the destinations data, merge the incoming data? Is the answer to this question simply “You can do whatever you want with the incoming data”?
EDIT:
I have not used but am planning on using the data-to-text-to-url-to-url-handler-to-data method discussed here. ASSUMING that this works, my question is I guess, can the destination parse the data as managed objects that I insert into the destination managed object context? The origin and destination have the same managed object model.
What you are trying to do may be possible if you send the contents of the entire .sqlite file itself. You would have to have your destination app build up an entire (i.e.
NSPersistentObjectStoreCoordinator) Core Data stack from the file that got saved into the destination sandbox.NSManagedObjectIDs are preferable if you have two stacks already pointing to the same URL (that you created theNSManagedObjectModelwith, and subsequently init’ed theNSPersistentStoreCoordinatorwith by[[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:model].