码迷,mamicode.com
首页 > 移动开发 > 详细

IOS从一个APP跳到另一个APP

时间:2016-08-06 23:21:15      阅读:287      评论:0      收藏:0      [点我收藏+]

标签:

以下为跳转到大众点评APP代码如下:

NSString *requestUrlString = @"dianping://shopinfo?id=1000";        
NSURL *requestUrl = [NSURL URLWithString: requestUrlString]; if([[UIApplication sharedApplication] canOpenURL:requestUrl]) { [[UIApplication sharedApplication] openURL:requestUrl]; } else { //没有安装应用,默认打开HTML5站 NSString *keywords = [@"吃饭饭" stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; requestUrl = [NSURL URLWithString:[NSString stringWithFormat:@"http://m.dianping.com/shoplist/219/search?from=m_search&keyword=%@",keywords]]; [[UIApplication sharedApplication] openURL:requestUrl]; }

 跳转的过程中可能会出现ERROR:

error: "This app is not allowed to query for scheme dianping"

解决方法是在info.plist文件内添加以下配置项,将其列为白名单才可以正常检查是否已经安装此程序。

<key>LSApplicationQueriesSchemes</key>

<array>

        <string>weixin</string>

        <string>wechat</string>

        <string>dianping</string>

</array>

 

IOS从一个APP跳到另一个APP

标签:

原文地址:http://www.cnblogs.com/foxting/p/5745044.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!