1. 程式人生 > >自定義友盟分享 不需要設定title 的方法

自定義友盟分享 不需要設定title 的方法

?
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:^{
//
//        }];
        
    }];