ios跳转其他app
2022-11-04 本文已影响0人
ing_69c7
1.获取想跳转app的urlschema
2.配置Info.Plist里面的LSApplicationQueriesSchemes,添加对应urlschema
3.不要在xcode的url type中添加你要跳转的urlschema,这里添加作用是第三方app跳转回自己的app需要的urlschema,并不是第三方的urlschema!!!!
4.这里以跳转12123为例
NSURL *URL = [NSURL URLWithString:@"tmri12123://"];
if ([[UIApplication sharedApplication] canOpenURL:URL]) {
[[UIApplication sharedApplication]openURL:URL options:@{UIApplicationOpenURLOptionsSourceApplicationKey:@YES} completionHandler:^(BOOL success) {
// 回调
}];
}else{
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"https://apps.apple.com/cn/app/%E4%BA%A4%E7%AE%A112123/id1039727169"] options:@{} completionHandler:^(BOOL success) {
// 回调
}];
}