新建兩個應用,分別爲ProjectA和ProjectB.
而後從A貢獻數據到B app
而後設置ProjectB的Url Schemes ide
在ProjectA 添加跳轉Url: url
NSURL *url = [NSURL URLWithString:@"projectb:hehe"]; [[UIApplication sharedApplication] openURL:url];
那麼projectb:hehe 冒號後面的參數就是咱們能夠傳過去的數據 spa
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { NSLog(@"ProjectB_start"); // Override point for customization after application launch. return YES; }
//當一個應用程序被其餘程序打開的時候會調用這個方法,在該方法中能夠實現兩個應用程序間的數據局傳遞 -(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { NSLog(@"%@",url); NSLog(@"%@",sourceApplication); return YES; }
是否是很簡單,那你也趕忙動手試試吧! code