1. 找到你要跳转的应用app, 设置scheme
步骤如下:
2. 运行app, 让模拟器存有scheme
如果不是测试app, 那么scheme可以由被跳转app供应商提供
3. 找到你准备加调整的项目,打开 ,写入一下代码:
-(void)touchesBegan:(NSSet*)touches withEvent:(UIEvent *)event
{
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"nav://"]]) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"nav://"] options:@{} completionHandler:^(BOOL success) {
}];
}
else{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.apple.com/cn/itunes/charts/"] options:@{} completionHandler:^(BOOL success) {
}];
}
4 运行,测试