方法1:
– (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions方法中,參數字典launchOptions包含瞭調用該函數的應用名稱(UIApplicationLaunchOptionsSourceApplicationKey)和URL(UIApplicationLaunchOptionsURLKey)
//處理應用程序間信息共享
if (launchOptions) {
NSString *sourceApp = [launchOptions objectForKey:UIApplicationLaunchOptionsSourceApplicationKey];
NSURL * urlToOpen = [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey];
if (urlToOpen != nil)
{}
}
方法2:
/*
*響應其他應用程序通過URL方案來調用該程序時的方法
*/
– (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url{
NSString * urlToOpen = [NSString stringWithFormat:@"%@",url];
return YES;
}