微信QQ分享回话


报错:This app is not allowed to query for scheme xxx

修改info.plist文件

<key>LSApplicationQueriesSchemes</key>

<array>

        <string>mqqOpensdkSSoLogin</string>

        <string>mqzone</string>

        <string>sinaweibo</string>

        <string>alipayauth</string>

        <string>alipay</string>

        <string>safepay</string>

        <string>mqq</string>

        <string>mqqapi</string>

        <string>mqqopensdkapiV3</string>

        <string>mqqopensdkapiV2</string>

        <string>mqqapiwallet</string>

        <string>mqqwpa</string>

        <string>mqqbrowser</string>

        <string>wtloginmqq2</string>

        <string>weixin</string>

        <string>wechat</string>

</array>



AppDelegate.m文件

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    // Override point for customization after application launch.

    //微信

    [WXApi registerApp:[NSString stringWithFormat:@"wx399e40c1eda152a7"]];

    return YES;

}


-(BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options {

    //QQ分享

//    [TencentOAuth HandleOpenURL:url];

    [QQApiInterface handleOpenURL:url delegate:self];  

    //微信分享

    return [WXApi handleOpenURL:url delegate:self];

}


//代理方法(QQ、微信一样)

-(void) onReq:(BaseReq *)req {

    NSLog(@"\n\n\n%@",req);

}


-(void) onResp:(BaseResp *)resp {

    NSLog(@"\n\n\n%@",resp);

}



ViewController.m文件

分享微信:

- (IBAction)weixinAction:(id)sender {

    WXMediaMessage *message = [WXMediaMessage message];

    message.title = @"title";

    message.description  = @"description";

    [message setThumbImage:[UIImage imageNamed:@"1"]];

    WXWebpageObject *webPageObject = [WXWebpageObject object];

    webPageObject.webpageUrl = @"http://www.baidu.com";

    message.mediaObject = webPageObject;

    SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];

    req.bText = NO;

    req.message = message;

    req.scene = WXSceneSession;

    [WXApi sendReq:req];

    

}



QQ分享文本内容:

- (IBAction)qqAction:(id)sender {

    

    TencentOAuth *one = [[TencentOAuth alloc]initWithAppId:@"1105022167" andDelegate:self];

//    [one authorize:[NSArray arrayWithObjects:@"ADD_TOPIC", nil] inSafari:NO];

    

    QQApiTextObject *txtObj = [QQApiTextObject objectWithText:@"text"];

    SendMessageToQQReq *req = [SendMessageToQQReq reqWithContent:txtObj];

    //将内容分享到qq

    QQApiSendResultCode sent = [QQApiInterface sendReq:req];

}




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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值