Roger Gilbrat
Roger Gilbrat

Reputation: 3825

Two iPhone Apps sharing information

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.

Upvotes: 2

Views: 199

Answers (2)

Timothée Boucher
Timothée Boucher

Reputation: 1565

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:)

Upvotes: 1

Will Hartung
Will Hartung

Reputation: 118593

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

Upvotes: 1

Related Questions