What Is Sandbox in iOS? How to Transfer Data Between One App to Another App

What is Sandbox in iOS? Can I transfer data between one app to another app?

From The iOS Environment

For security reasons, iOS places each app (including its preferences
and data) in a sandbox at install time. A sandbox is a set of
fine-grained controls that limit the app’s access to files,
preferences, network resources, hardware, and so on. As part of the
sandboxing process, the system installs each app in its own sandbox
directory, which acts as the home for the app and its data.

one solution to transmit data from one to another app is via URL Schemes

iOS - transferring in-apps between apps

It's possible to transfer data from one app to another quite easily if your users have both apps installed, however it's not possible to transfer in app purchases from one app to another.

What you'll have to do is update your legacy app to support some kind of action or link to the new app, then open the new app from within the old app with UIApplication openURL: and pass through some meta data about the upgrade.

Then from within the new app your app delegate will receive didFinishLaunchingWithOptions: with the URL used to launch the app, you can then download their purchase.

This functionality is supported by registering URL scheme for you new app, which is an info.plist setting.

A problem you're going to have with the above transfer of purchase meta data between the old app and the new one will be the fact that restoring their purchase will not be possible via StoreKit/Apple (as noted above, transfers are not possible).

You could get around this issue and provide your existing customers with the ability to restore their purchases if you had two in app purchase SKUs for your new app.

One item is the usual item that new customers will need to pay for, the other is identical but $0 for existing customers to 'buy' so they have a purchase registered with StoreKit/Apple for them to restore in the future without the old app.

The new app can conditionally display this $0 option for existing customers if they've upgraded via the method above.



Related Topics



Leave a reply



Submit