今天上线项目是,这一版做了微信登录,但是如果用户没有安装微信时没有做处理,结果上线被拒,原因是
We were required to install WeChat before we could use WeChat to login. Users should be able to use their account, without requiring additional apps to be installed.
代码修改后的:
- (IBAction)weiXinLogin {
SendAuthReq *req = [[SendAuthReq alloc] init];
req.scope = @"snsapi_userinfo";
req.state = @"GSTDoctorApp";
if ([WXApi isWXAppInstalled]) {
[WXApi sendReq:req];
} else { // 没有安装微信
[WXApi sendAuthReq:req viewController:self delegate:self];
}
}
之前是没有安装微信的时候什么也没做,加上下面那句代码就可以了。这样之后如果用户没有安装微信会自动跳到微信web端登录,输入手机号之后,回收到一条带链接的短信,点击链接就能实现微信登录。