应用间跳转

打开设置对应
NSArray *array = @[@{@"系统设置":@"prefs:root=INTERNET_TETHERING"},@{@"WIFI设置":@"prefs:root=WIFI"},@{@"蓝牙设置":@"prefs:root=Bluetooth"},@{@"系统通知":@"prefs:root=NOTIFICATIONS_ID"},@{@"通用设置":@"prefs:root=General"},@{@"显示设置":@"prefs:root=DISPLAY&BRIGHTNESS"},@{@"壁纸设置":@"prefs:root=Wallpaper"},@{@"声音设置":@"prefs:root=Sounds"},@{@"隐私设置":@"prefs:root=privacy"},@{@"APP Store":@"prefs:root=STORE"},@{@"Notes":@"prefs:root=NOTES"},@{@"Safari":@"prefs:root=Safari"},@{@"Music":@"prefs:root=MUSIC"},@{@"photo":@"prefs:root=Photos"}];
 NSURL * url = [NSURL URLWithString:[array[0] allValues].firstObject];
[[UIApplication sharedApplication]openURL:url];




应用间跳转
AppDelegate
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(nullable NSString *)sourceApplication annotation:(id)annotation NS_DEPRECATED_IOS(4_2, 9_0, "Please use application:openURL:options:") __TVOS_PROHIBITED

{
    NSLog(@"~~~~~~%@", [url scheme]);
    
NSLog(@"----aaa-----%@", [url host
]);//打印1234
    
NSLog(@"======%@", [url resourceSpecifier
]);//打印//1234
    
    
if ([[url scheme] isEqualToString:@"aaaa"
])
    {
        
NSLog(@"%@"
,url);
    }
    
return YES
;
}

跳转方法
bbbb跳转app的标识 URL Schemes 
: 比加   就是这个格式  
//1234 携带过去的参数  用于判断是谁打开的app
NSString *url = [NSString stringWithFormat:@"bbbb://1234"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];







//////////////////提示用户更新    跳转到appStore
 NSString *num1 = @"5.2.0";//APP版本
    NSString *num2 = @"5.3.0";//请求接口版本
    
    if ([num1 compare:num2 options:NSNumericSearch] == NSOrderedDescending)
    {
        NSLog(@" 降序");
    }else if ([num1 compare:num2 options:NSNumericSearch] == NSOrderedSame){
        NSLog(@" 相等");
    }else if ([num1 compare:num2 options:NSNumericSearch] == NSOrderedAscending){
        NSLog(@" 升序");
更新app
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlStr]];
    }
解释:
NSOrderedDescending是降序,num1>num2
NSOrderedSame是相等,num1=num2
NSOrderedAscending是升序,num1

你可能感兴趣的:(应用间跳转)