首页 > IOS 模拟器使用腾讯 SDK 登录问题

IOS 模拟器使用腾讯 SDK 登录问题

在模拟器上登录,执行了代码

[tencentOAuth authorize:permissions inSafari:NO];

在模拟器上显示提示没有安装最新版的QQ空间客户端。
但是SDK里的Demo却可以正常打开输入帐号密码的页面。

贴上主要代码

**ViewController.h**

@interface PersonalCenterViewController : UIViewController <TencentSessionDelegate>{
    TencentOAuth* tencentOAuth;
    NSMutableArray* permissions;
}
@property (weak, nonatomic) IBOutlet UIButton *TencentOAuth;

@end

**ViewController.m**
- (void)viewDidLoad
{
 permissions = permissions = [NSArray arrayWithObjects:@"get_user_info", @"add_t", nil] ;
    NSString* appid = @"10107****";
    tencentOAuth = [[TencentOAuth alloc] initWithAppId:appid andDelegate:self];
    tencentOAuth.redirectURI = @"www.qq.com";
}



-(IBAction)TencentOAuth:(id)sender {
    [tencentOAuth authorize:permissions inSafari:NO];
}

update:官方给出解释


我最终放弃了这个 SDK(腾讯有很多 SDK 的),使用腾讯微博的 SDK

第三方登录 SDK 界最烂的是人人毋庸置疑,其次是腾讯,QQ、空间、微信、腾讯微博各自一套 SDK 是闹哪样。

这是今天早上使用腾讯开放平台被折磨的半死不活的时候写的微博。这是我遇到的问题。而且这种登录方式似乎必须要求有 QQ 空间客户端?放弃这个 SDK,转向了腾讯微博开放平台。

1.创建新的接入应用获取 Key、Secret

这是链接,不多说。

2.下载SDK

SDK 在 github 上。

    git clone https://github.com/heloyue/TCWeiboSDK

3.加入工程

4.开始写代码

1.在 AppDelegate.h 中

加入

    @property (strong, nonatomic) PersonalCenterViewController *viewController;//PersonalCenterViewController 是我的 ViewController 这里作为例子,替换成你的

2.在 AppDelegate.m 中

实现这两个方法

-(BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
return [self.viewController.weiboApi handleOpenURL:url];//这里的 weiboApi 待会儿再声明
}

//Available in iOS 4.2 and later.
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
return [self.viewController.weiboApi handleOpenURL:url];
}

3.在 ViewController.h 中

导入头文件

    #import "WeiboApi.h"

声明 weiboApi

    @interface PersonalCenterViewController : UIViewController<WeiboRequestDelegate,WeiboAuthDelegate>{
WeiboApi* weiboApi;
}
@property (weak, nonatomic) IBOutlet UIButton *OAuth;

@property (nonatomic,retain) WeiboApi* weiboApi;
@end

4.在 ViewController.m 中

大功告成

【热门文章】
【热门文章】