IOS 使用腾讯开放平台QQ登录iOS9.1不能调起qq客户端或者web版的问题

<key>LSApplicationQueriesSchemes</key>

<array>

<string>mqq</string>

<string>wtloginmqq2</string>

<string>mqqopensdkapiV3</string>

<string>mqqopensdkapiV2</string>

<string>mqqwpa</string>

<string>mqqOpensdkSSoLogin</string>

<string>mqzone</string>

                <string>mqzone</string>

                <string>mqqapi</string>

</array>

<key>NSAppTransportSecurity</key>

<dict>

<key>NSAllowsArbitraryLoads</key>

<true/>

</dict> 

主要代码:

//
//  ViewController.m
//  QQLogin_ShareDemo
//
//  Created by Tina on 15/12/7.
//  Copyright © 2015年 Tina. All rights reserved.
//

#import "ViewController.h"
#import "TencentOpenAPI/TencentOAuth.h"

@interface ViewController ()<TencentSessionDelegate>
{
    TencentOAuth *_tencentOAuth;
    NSArray *_permissions;
}

@property (strong, nonatomic) IBOutlet UIView *loginButton;
- (IBAction)Click:(UIButton *)sender;
- (IBAction)ShareClick:(UIButton *)sender;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    _tencentOAuth = [[TencentOAuth alloc]initWithAppId:@"1104800177" andDelegate:self];
    _permissions = [[NSArray alloc]initWithObjects:kOPEN_PERMISSION_GET_USER_INFO,kOPEN_PERMISSION_ADD_SHARE,kOPEN_PERMISSION_GET_SIMPLE_USER_INFO, nil];
    
    
    
}

-(void)tencentDidNotNetWork
{
    NSLog(@"no netWork");
}

-(void)tencentDidNotLogin:(BOOL)cancelled
{
    if (cancelled)
    {
        //  记录登录用户的OpenID、Token以及过期时间
        NSLog(@"cancel");
    }
    else
    {
        NSLog(@"fail");
    }
}

-(void)getUserInfoResponse:(APIResponse *)response
{
    NSLog(@"respons:%@",response.jsonResponse);
}

-(void)tencentDidLogin
{
    if (_tencentOAuth.accessToken && 0 != [_tencentOAuth.accessToken length])
    {
        //  记录登录用户的OpenID、Token以及过期时间
        NSLog(@"accessToken:%@",_tencentOAuth.accessToken);
        [_tencentOAuth getUserInfo];
    }
    else
    {
        NSLog(@"fail");
    }
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)Click:(UIButton *)sender {
    
    NSLog(@"iphoneQQSupportSSOLogin:%d",[TencentOAuth iphoneQQSupportSSOLogin]);
    NSLog(@"iphoneQQInstalled:%d",[TencentOAuth iphoneQQInstalled]);
    //if ([TencentOAuth iphoneQQInstalled]) {
        [_tencentOAuth authorize:_permissions];
    //}
    
    
}

- (IBAction)ShareClick:(UIButton *)sender {
    
    NSLog(@"分享按钮");
    
}
@end


转载于:https://my.oschina.net/u/2430056/blog/540608

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值