leancloud / leancloud-social-ios

LeanCloud 社交登录组件,轻松加入 QQ、微博、微信登录
https://leancloud.cn/docs/sns.html
159 stars 50 forks source link

修复第三方登录 WebView 登录链接失效问题 #67

Closed SXiaoXu closed 6 years ago

SXiaoXu commented 6 years ago

测试第三方登录时遇到的问题:

这四个方法都是登录入口方法: +loginWithCallback: +loginWithCallback: toPlatform: +loginManuallyWithCallback: +loginManuallyWithCallback:toPlatform:

其中两个带 toPlatform 参数的方法传了AVOSCloudSNSType,是没有问题的。 另外两个不带 toPlatform 参数的方法没有传AVOSCloudSNSType,也就是下面 type==0:

  if (type==0) {
        //打开选择登录界面

        NSString *url=[NSString stringWithFormat:@"https://%@/%@",AVOS_SNS_BASE_URL,@"sns.html"];

        [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
        return;
    }

上面的 url 是有问题:https://cn.avoscloud.com/sns.html ===》404 运行效果: sns_ios

url 改为 AVOS_SNS_BASE_URL2 即 https://leancloud.cn/sns.html 就好了。

已经测试过,修改后 url 后无论是 SSO 登录,还是 webView 授权登录,这两个方法都可以正常登录了。

SXiaoXu commented 6 years ago

@zapcannon87