知識(shí)點(diǎn):
????? 兩個(gè)APP之間的跳轉(zhuǎn)是通過(guò)[[UIApplicationsharedApplication] openURL:url]這種方式來(lái)實(shí)現(xiàn)的腊瑟。
step1.首先我們需要?jiǎng)?chuàng)建兩個(gè)app? 分別命名為firstAPP? 和secondAPP
step2. 在secondAPP中添加URL Types (目的是可以讓別的app訪問(wèn)到自己)
step3.在firstAPP中添加白名單(這是ios現(xiàn)在權(quán)限限制必須添加的)
step4.實(shí)現(xiàn)從firstAPP跳轉(zhuǎn)到secondAPP的功能
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"secondAPPTag://"]]) {
????? if([UIDevice currentDevice].systemVersion.floatValue >= 9.0){
? ? ? ? ? ? [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"secondAPPTag://"] options:@{} completionHandler:nil];
????? }else{
?????????? [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"secondAPPTag://"]];
}
如果需要傳值的話類(lèi)似get方式傳參數(shù)
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"secondAPPTag://www.bai.com?para1=1¶2=2"]];
step5.secondAPP接受和處理參數(shù)
解析參數(shù)的方式和get請(qǐng)求網(wǎng)絡(luò)時(shí)反解析一致:secondAPP://www.bai.com?para1=1*para2=2
secondAPP跳轉(zhuǎn)firstAPP同理? 反向設(shè)置.