iOS6和iOS7环境下微信登录未显示问题&微信IOS的SDK:isWXAppInstalled总是返回NO和nil

iOS6和iOS7环境下微信登录未显示问题&微信IOS的SDK:isWXAppInstalled总是返回NO和nil

一、问题描述:

     iOS6和iOS7 环境下未显示微信登录界面,在其他环境下显示正常。

 

二、问题解决:

       iOS6和7未出现微信登录按钮, 原因 [WXApi isWXAppInstalled] 返回nil和NO:

if ([WXApi isWXAppInstalled]) {

...

}

 修改为如下判断URL:

if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"weixin://"]])
{
NSLog(@"OK weixin://");
}
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"wechat://"]])
{
NSLog(@"OK wechat://");
}
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fb290293790992170://"]])
{
NSLog(@"OK fb——————://");
}

   修改 if ([WXApi isWXAppInstalled]) 为 if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"weixin://"]])

即修改判断微信登录与否改为判断微信的URL;

  修改后结果:iOS6和7环境下均可正常显示及跳转。

参考链接:https://www.zhihu.com/question/21306514

原文地址:https://www.cnblogs.com/wangmaster/p/5275989.html