自定义友盟分享 不需要设置title 的方法

支持title设置的平台:QQ、QQ空间、微信、微信朋友圈

QQtitle设置方法:
[Objective-C]  纯文本查看  复制代码
?
1
[UMSocialData defaultData].extConfig.qqData.title = @"QQtitle" ;


QQ空间title设置方法:
[Objective-C]  纯文本查看  复制代码
?
1
[UMSocialData defaultData].extConfig.qzoneData.title = @"Qzonetitle" ;


微信title设置方法:
[Objective-C]  纯文本查看  复制代码
?
1
[UMSocialData defaultData].extConfig.wechatSessionData.title = @"微信title" ;


朋友圈title设置方法:
[Objective-C]  纯文本查看  复制代码
?
1
[UMSocialData defaultData].extConfig.wechatTimelineData.title = @"朋友圈title" ;

[[UMSocialData defaultData].urlResource setResourceType:UMSocialUrlResourceTypeImage url:[NSString stringWithFormat:@"http://zandouji.icodestar.com/index.php?m=Index&a=index&id=%ld",(long)model.info.infoId]];
     UIImage *icoiImg = [LThemeComonUtil DLImage:@"side_head"];
    [UMSocialData defaultData].extConfig.wechatSessionData.title = @"";
    
    [UMSocialData defaultData].extConfig.qqData.url = [NSString stringWithFormat:@"http://zandouji.icodestar.com/index.php?m=Index&a=index&id=%ld",(long)model.info.infoId];
    [UMSocialData defaultData].extConfig.wechatTimelineData.url = [NSString stringWithFormat:@"http://zandouji.icodestar.com/index.php?m=Index&a=index&id=%ld",(long)model.info.infoId];
    [UMSocialData defaultData].extConfig.wechatSessionData.url = [NSString stringWithFormat:@"http://zandouji.icodestar.com/index.php?m=Index&a=index&id=%ld",(long)model.info.infoId];


DLActionModel *action4 = [[DLActionModel alloc] initWithName:@"微信好友" iconName:@"share_btn_weixin_nor" handler:^{
        
        
        
        NSLog(@"微信好友");
        if (model.info.typeId == 2) {
            [UMSocialData defaultData].extConfig.wxMessageType = UMSocialWXMessageTypeVideo;
        }
        
        if (IOS_8_BEFORE && model.info.content.length > 30) {
            NSString *myContent = [model.info.content substringToIndex:30];
            myContent = [NSString stringWithFormat:@"%@...",myContent];
            
            if (model.info.imgPath.count > 0) {
                NSData * gifData = [NSData dataWithContentsOfURL:[NSURL URLWithString:[model.info.imgPath objectAtIndex:0]]];
                
                [[UMSocialDataService defaultDataService]  postSNSWithTypes:@[UMShareToWechatSession] content:myContent   image:gifData location:nil urlResource:[UMSocialData defaultData].urlResource presentedController:self completion:^(UMSocialResponseEntity *response){
                    if (response.responseCode == UMSResponseCodeSuccess) {
                        NSLog(@"分享成功!");
                        //                        if (_shareResult) {
                        //                            _shareResult(YES,nil);
                        //                        }
                        //                        [self dismissTips];
                        //                        [self initShareBgView];
                    }
                    else
                    {
                        //                            [self presentMessageTips:[[response.data objectForKey:@"sina"] objectForKey:@"msg"]];
                        [self presentMessageTips:@"分享失败"];
                        
                    }
                }];
            }
            else
            {
                
                [[UMSocialDataService defaultDataService]  postSNSWithTypes:@[UMShareToWechatSession] content:myContent   image:icoiImg location:nil urlResource:[UMSocialData defaultData].urlResource presentedController:self completion:^(UMSocialResponseEntity *response){
                    if (response.responseCode == UMSResponseCodeSuccess) {
                        NSLog(@"分享成功!");
                        //                        if (_shareResult) {
                        //                            _shareResult(YES,nil);
                        //                        }
                        //                        [self dismissTips];
                        //                        [self initShareBgView];
                    }
                    else
                    {
                        //                            [self presentMessageTips:[[response.data objectForKey:@"sina"] objectForKey:@"msg"]];
                        [self presentMessageTips:@"分享失败"];
                        
                    }
                }];
            }
            
        }
        else
        {
            
            if (model.info.imgPath.count > 0) {
                NSData * gifData = [NSData dataWithContentsOfURL:[NSURL URLWithString:[model.info.imgPath objectAtIndex:0]]];
                
                [[UMSocialDataService defaultDataService]  postSNSWithTypes:@[UMShareToWechatSession] content:[NSString stringWithFormat:@"%@",model.info.content]   image:gifData location:nil urlResource:[UMSocialData defaultData].urlResource presentedController:self completion:^(UMSocialResponseEntity *response){
                    if (response.responseCode == UMSResponseCodeSuccess) {
                        NSLog(@"分享成功!");
                        //                        if (_shareResult) {
                        //                            _shareResult(YES,nil);
                        //                        }
                        //                        [self dismissTips];
                        //                        [self initShareBgView];
                    }
                    else
                    {
                        //                            [self presentMessageTips:[[response.data objectForKey:@"sina"] objectForKey:@"msg"]];
                        [self presentMessageTips:@"分享失败"];
                        
                    }
                }];
            }
            else
            {
                
                [[UMSocialDataService defaultDataService]  postSNSWithTypes:@[UMShareToWechatSession] content:[NSString stringWithFormat:@"%@",model.info.content]    image:icoiImg location:nil urlResource:[UMSocialData defaultData].urlResource presentedController:self completion:^(UMSocialResponseEntity *response){
                    if (response.responseCode == UMSResponseCodeSuccess) {
                        NSLog(@"分享成功!");
                        //                        if (_shareResult) {
                        //                            _shareResult(YES,nil);
                        //                        }
                        //                        [self dismissTips];
                        //                        [self initShareBgView];
                    }
                    else
                    {
                        //                            [self presentMessageTips:[[response.data objectForKey:@"sina"] objectForKey:@"msg"]];
                        [self presentMessageTips:@"分享失败"];
                        
                    }
                }];
            }
        }
        
        
//        UmengShareVC *vc = [[UmengShareVC alloc] init];
//        vc.model = model;
//        vc.shareType = ShareTypeWX;
//        [self presentViewController:vc animated:YES completion:^{
//
//        }];
        
    }];


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值