1

请支持原文:http://tryenough.com/ios-installcheck

步骤一:iOS9后设置白名单

在iOS9中,需要在"Info.plist"中设置所涉及到的 URL scheme 到白名单,设置方法如下:

打开Info.plist,可以选择以代码方式打开:

添加如下例子内容:

<key>LSApplicationQueriesSchemes</key>
<array>
   <string>twitter</string>
   <string>fb</string>
  <string>...这里写到的都是app的scheme名子...</string>
</array> 

常见的app的sheme名字如下:

请支持原文:http://tryenough.com/ios-installcheck

<key>LSApplicationQueriesSchemes</key>
<array> 
<!-- 微信 URL Scheme 白名单--> 
<string>wechat</string> 
<string>weixin</string> 
<!-- 新浪微博 URL Scheme 白名单--> 
<string>sinaweibohd</string> 
<string>sinaweibo</string> 
<string>sinaweibosso</string> 
<string>weibosdk</string> 
<string>weibosdk2.5</string> 
<!-- QQ、Qzone URL Scheme 白名单--> 
<string>mqqapi</string> 
<string>mqq</string> 
<string>mqqOpensdkSSoLogin</string> 
<string>mqqconnect</string> 
<string>mqqopensdkdataline</string> 
<string>mqqopensdkgrouptribeshare</string> 
<string>mqqopensdkfriend</string> 
<string>mqqopensdkapi</string> 
<string>mqqopensdkapiV2</string> 
<string>mqqopensdkapiV3</string> 
<string>mqzoneopensdk</string> 
<string>wtloginmqq</string> 
<string>wtloginmqq2</string> 
<string>mqqwpa</string> 
<string>mqzone</string> 
<string>mqzonev2</string> 
<string>mqzoneshare</string> 
<string>wtloginqzone</string> 
<string>mqzonewx</string> 
<string>mqzoneopensdkapiV2</string> 
<string>mqzoneopensdkapi19</string> 
<string>mqzoneopensdkapi</string> 
<string>mqzoneopensdk</string> 
<!-- 支付宝 URL Scheme 白名单--> 
<string>alipay</string> 
<string>alipayshare</string>
</array>

步骤二:使用代码检查是否安装了应用

例如检查是否安装了twitter:

if(![[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"twitter://"]]) {
    NSLog(@"UnInstall twitter");
    return;
}

请支持原文:http://tryenough.com/ios-installcheck


roundstones
44 声望7 粉丝