ios 使用Safari浏览器跳转打开、唤醒app

常常使用Safari浏览器浏览网页点击url会唤醒该站点的手机版app

须要在app的project中设置

1、打开project中的myapp-Info.plist文件

2、打开文件里新增URL TYPES的一项。详细例如以下图所看到的:

ios 使用Safari浏览器跳转打开、唤醒app

3、在project中实现例如以下方法

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {

    if (url) {

        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:@"你唤醒了您的应用" delegate:selfcancelButtonTitle:@"确定" otherButtonTitles:nil, nil];

        [alertView show];

    }

    return YES;

}

4、在Safari浏览器输入myapp:// ,就能够启动应用了,在Safari浏览器測试通过