views:

93

answers:

2

I am building a series of games for the iPhone that are released in 'episodes' that are purchased separately. I'd like each of the Apps to share a small bit of information, but Apps seems to be sandboxed pretty tightly.

Is there an official way for two apps to share information that doesn't involve hitting an external server? I only need to share about 50 bytes.

+1  A: 

Write a single app and download the episodes as separate for pay content in to the single app.

Will Hartung
+1  A: 

One way could be to register a custom URL scheme for each of your apps. And you would ask the user to open the episode n which would link to episode n+1 with your specific info in the URL.

When the app n+1 opens, you can treat the info from the URL. Make sure to put safeguards in against tempering the URLs (if that's important for your app).

To do that, implement the following method in your application delegate:

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url

Apple Doc for handleOpenURL:

NB: In episode n, you could use the method canOpenURL: to know if episode n+1 is installed or not, thus behaving differently. Similarly, n+1 could know if the user has n already and then ask if the user wants to get their info from n and open it for them… It's up to you at that point :)

You can also look at

`- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions`

which seems to be newer and includes the treatment of the case of an app launched from a remote notification. (Apple Doc for didFinishLaunchingWithOptions:)

Timothée Boucher
And with `canOpenURL` and `openURL` you can even make it so that `n+1` detects that `n` is here, automatically launches `n`, which knows that it should send the data, thus calls `openURL` again to open `n+1` right away. It might be kind of distressing for the user to see the apps closing and opening, but you get my point.
Timothée Boucher
This is the way I've considered doing it many times, if I ever got the chance to do something this interesting.
Ed Marty