Is it possible to share a core data store between two different iPhone apps signed by the same developer? I would like to develop an application where one iPhone app will save a stream of data, which can then be read by the other app. Is this even possible? Thanks a lot!
No, that's not possible. An iPhone application runs in a sandbox and though doesn't have access to another applications data store.
Edit:
After reading the others answers here: Yes, Custom URLs are possible. And yes it's possible to transfer data with it, but, I, in my opinion, wouldn't recommend this procedure to transfer more than 5kb of data. There is no failsafe: No transactions and no relations.
Now in iOS 5 with iCloud you can register both apps with the same iCloud URL. On initialization of the second app, the core data store of the first is more/less copied into the second. This can take while---so you need to start the persistent store controller in a background thread, or you app will be killed by a watchdog timer.
However, there are a few caveats.
It doesn't seem to work completely correctly. Some records form the core data database do not seem to be copied. In my experience it seems random which records do not make it. Maybe it is related to to consistency of the original store.
afterwards, the tho apps do not seem to stay in sync, contrary to the same app on two different iDevices.
Debugging is a bit of a pain, as it takes 10--20 seconds before a change from one iDevice is transferred to another, and apparently indefinitely before a change from one app on the same iDevice makes it to another app registered with the same iCloud URL.
So in summary---you can copy most records using iCloud on init of the second app, but it is hard to keep them in sync.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With