iOS 网页跳转 APP 的简单设置

1: 进入 APP 在 info.plist 中Add Row:"URL types",其中 URL identitfier 为 App ID,URL Schemes中的 Item 0 为自定义的 scheme:XXX, 如下配置,运行,此时打开 Safari 输入:"XXX://", 点击前往即可进入 APP

iOS 网页跳转 APP 的简单设置_第1张图片
iOS 网页跳转 APP 的简单设置_第2张图片

2: 进入 APP 指定界面 在代理类里执行方法:

-(BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary*)options

options 中含有本次操作的详细信息,我们只需要获取 url 即可,里面可设置参数,以判断跳转到哪个界面,如:

if ([urlStr containsString:@"fengyu"]) {

// 发送跳转到制定界面的通知

[[NSNotificationCenter defaultCenter]postNotificationName:@"NOTIFICATIOFORGOODSNDETAIL" object:nil];

}else{

return NO;

}

你可能感兴趣的:(iOS 网页跳转 APP 的简单设置)