iOSQQ第三方登录

2017-05-08  本文已影响2039人  风外杏林香

前段时间集成了微信第三方登录,今天又集成了QQ第三方登录,遇到了小坑,记录下,
首先、腾讯开放平台下载sdk包,最新的应该是3.2.0的,下载完成之后,直接导入TencentOpenApi_IOS_Bundle.bundle 和 TencentOpenAPI.framework库文件,同时,添加相应的依赖库

“SystemConfiguration.framework”、
“CoreGraphics.Framework”、
“libsqlite3.tbd”、
“CoreTelephony.framework”、
“libstdc++.tbd”、
“libz.dylib”、
Security.framework”```
在项目工程`build setting` -- `other linker flag`中添加`-fobjc-arc`注意大小写,在info中,添加`URL Type identifier = tencentopenapi  URL Scheme = tencent+appid`
接下来,可以写代码了
`appdelegate.h`,文件中导入头文件`#import <TencentOpenAPI/TencentOAuth.h>`
同时,俩个代理方法
最后,在登录页面
导入头文件`#import <TencentOpenAPI/TencentOAuth.h>`同时遵循`TencentSessionDelegate`三个代理方法
最后三个代理方法

pragma mark -- TencentSessionDelegate

}

-(void)tencentDidNotLogin:(BOOL)cancelled
{
if (cancelled) {
NSLog(@"取消登录");
}
}
-(void)tencentDidNotNetWork
{
NSLog(@"tencentDidNotNetWork");
}

pragma mark -- 获取用户个人信息

做他们该做的事,以上,就是第三方qq登录,纯手打,nice
上一篇 下一篇

猜你喜欢

热点阅读