ios中分享的回调地址

来源:互联网 发布:豫章学院 知乎 编辑:程序博客网 时间:2024/06/05 04:40
- (BOOL)applicationUIApplication *)application openURLNSURL *)url sourceApplicationNSString *)sourceApplication annotationid)annotation
{
if ([url.absoluteString hasPrefix"tencent"]) {
[QQApiInterface handleOpenURL:url delegate:self]];
return YES;
}
-(void) onRespQQBaseResp*)resp
{

}
问题描述:用qq和微信官方SDK做好友分享,微信可以回调返回分享结果,但是qq不行。官方文档也没说什么实质性的内容,代码如下,各位帮忙找找错。
-(BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url{
    
    if ([url.scheme isEqualToString:@"wxd930ea5d5a258f4f"]) {
        return [WXApi handleOpenURL:url delegate:self];
    }else if ([url.scheme isEqualToString:[NSString stringWithFormat:@"tencent%s","222222"]]) {
        return [TencentOAuth HandleOpenURL:url];
    }else {
        return YES;
    }
}

-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{
    if ([url.scheme isEqualToString:@"wxd930ea5d5a258f4f"]) {
        return [WXApi handleOpenURL:url delegate:self];
    }else if ([url.scheme isEqualToString:[NSString stringWithFormat:@"tencent%s","222222"]]) {
        [QQApiInterface handleOpenURL:url delegate:self];
    }else {
        return YES;
    }
    //return [TencentOAuth HandleOpenUrl:url];
}

-(void)onResp:(id)resp
{
    if ([resp isKindOfClass:[SendMessageToWXResp class]])
    {
        SendMessageToWXResp *WxResp = (SendMessageToWXResp *)resp;
        
        NSString *str ;//= [NSString stringWithFormat:@"%d",resp.errCode];
        if(WxResp.errCode==0)
        {
            str=@"分享成功!";
        }
        else{
            str=@"分享失败!";
        }
        UIAlertView *shareresultalertview = [[UIAlertView alloc] initWithTitle:@"结果反馈" message:str delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
        [shareresultalertview show];
        [shareresultalertview release];
    }
    if ([resp isKindOfClass:[SendMessageToQQResp class]]) {
       
                SendMessageToQQResp * QQResp = (SendMessageToQQResp *)resp;
                if (QQResp.type==ESENDMESSAGETOQQRESPTYPE&&[QQResp.result integerValue]==0)
                {
                    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"成功" message:@"QQ分享成功" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
                    [alert show];
                    [alert release];
                }
                else
                {
                    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"失败" message:@"QQ分享失败" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
                    [alert show];
                    [alert release];
                }
        
    }


关键词:qq微信好友分享
回复引用
举报顶端
hello_man
级别: 新手上路
UID: 335231
精华: 0 
发帖: 68
可可豆: 77 CB
威望: 80 点
在线时间: 252(时)
注册时间: 2014-06-29
最后登录: 2017-09-27
1 楼: 发表于: 2017-02-27 10:17   发自: Web Page
只看该作者   小 中 大
if ([url.scheme isEqualToString:[NSString stringWithFormat:@"tencent%s","222222"]]) {
        return [TencentOAuth HandleOpenURL:url];
    }
你QQ的appid是"222222"么 
 
原创粉丝点击