iOS app中发起qq临时会话

2016-10-25  本文已影响77人  小傑

1.app中发起qq临时会话

#import <TencentOpenAPI/QQApiInterface.h>
#import <TencentOpenAPI/TencentOAuth.h>

//1.判断是否有qq
        if (![QQApiInterface isQQInstalled]) {//这是qqAPI里的方法
            [MBProgressHUD showSuccess:@"请安装qq" toView:self.view];
            return;
        }
        
        //2.发起对话
        UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero];
        NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"mqq://im/chat?chat_type=wpa&uin=%@&version=1&src_type=web",qq号]];
        NSURLRequest *request = [NSURLRequest requestWithURL:url];
        [webView loadRequest:request];
        [self.view addSubview:webView];

2.微信

//1.//app跳入微信公众号页面
if ([WXApi isWXAppInstalled]) {
        MyBonaServiceModel *model = self.array_model[indexPath.section];
        JumpToBizProfileReq *jumpReq = [[JumpToBizProfileReq alloc] init];
        jumpReq.username = model.number;
        jumpReq.extMsg = @"哈哈";
        jumpReq.profileType = WXBizProfileType_Normal;
       [WXApi sendReq:jumpReq];
    }
上一篇 下一篇

猜你喜欢

热点阅读