2

I have 2 different applications on the same device. I want to open first application from second one. How would that happen? Basically, I want to pass some data from app1 to app2 by tapping on some button inside app1. Once tapped, app2 should be launched & based on the passed in data some action is taken inside app2.

How to achieve this feature.

Abhinav
  • 37,684
  • 43
  • 191
  • 309

1 Answers1

2

make your own app "URL Scheme"

look at this

and this

you may check the code from facebook

// Pre 4.2 support
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
    return [facebook handleOpenURL:url]; 
}

// For 4.2+ support
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
    return [facebook handleOpenURL:url]; 
}

if your app open from other app you may get this method called

adali
  • 5,977
  • 2
  • 33
  • 40
  • Thanks for sharing this. 1 Q, if my app is not running then which method will be called - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url OR applicationDidFinishLaunchWithOptions? . So basically, what would be the life cycle of method calls so that I could handle the app initialization part correctly. – Abhinav May 04 '12 at 03:00