使用Share SDK 进行social share 时,由于iOS 9新特性可能会引起以下error:
" App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file. "
iOS9开始引入了安全传输协议,默认使用HTTPS协议。所以应须在info.plist文件中添加如下可选项:(打开方式:Open As->Source Code)
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
</true>
</dict>
“ #warning:尚未配置[微信]URL Scheme:wx4868b35061f87884, 无法使用进行授权。 ”
按照share sdk 开发文档,其微信的APP ID 需在 “- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;”方法中调用WXApi类下的registerApp:(NSString*)方法进行注册,其返回值为bool值,所以应该添加以下代码。(打印语句,便为调试)
if([WXApi registerApp:@"wx4868b35061f87885"]){
NSLog(@"注册成功");
}else{
NSLog(@"注册失败");
}
” -canOpenURL: failed for URL: "weixin://app/wx4868b35061f87885/" - error: "This app is not allowed to query for scheme weixin" “
此error源自iOS9 URL Scheme 特性,需将指定域名加入白名单,解决此问题分两步:
步一:在项目info 设置下 找到URL Types 选项下的 URL Schemes 添加其注册的 微信APP ID
步二:在info.plist文件中添加如下代码
<key>LSApplicationQueriesSchemes</key>
<array>
<string>weixin</string>
<string>wechat</string>//可省略
</array>