ShareSDK分享微博的问题

在有图片链接的时候,分享到微博,不像qq/微信那样直接带有链接,链接必须加到text里面,所以在保证弹出sheet的同时,将新浪微博的分享内容和其他平台区分开。

ShareSDK分享微博的问题_第1张图片

不说了,贴代码

//创建分享的参数

NSArray * imgArr = @[@"https://www.jingchujie.com/dybuat/css01/img/loginNew.png"];

if (imgArr) {

NSMutableDictionary * shareDic  = [NSMutableDictionary dictionary];

[shareDic SSDKEnableUseClientShare];

NSString * text = @"邀请好友注册有奖励哦~";

NSString * content = [NSString stringWithFormat:@"%@%@",text,_urlstr];

[shareDic SSDKSetupShareParamsByText:  text 

 images:imgArr url:[NSURL URLWithString:_urlstr] title:@"一起来吧!" type:SSDKContentTypeAuto];

[shareDic SSDKSetupSinaWeiboShareParamsByText:content 

title:@"一起来吧!" image:imgArr url:[NSURL URLWithString:_urlstr] latitude:0.0 longitude:0.0 objectID:nil type:SSDKContentTypeAuto];

//分享

[ShareSDK showShareActionSheet:nil items:nil shareParams:shareDic onShareStateChanged:^(SSDKResponseState state, SSDKPlatformType platformType, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error, BOOL end) {

switch (state) {

case SSDKResponseStateSuccess:

{

UIAlertView * alertview = [[UIAlertView alloc] initWithTitle:@"分享成功" message:nil delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];

[alertview  show];

}

break;

case SSDKResponseStateFail:

{

NSLog(@"%@",error);

UIAlertView * alertview = [[UIAlertView alloc] initWithTitle:@"分享失败" message:[NSString stringWithFormat:@"%@",error] delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil, nil];

[alertview show];

}

break;

default:

break;

}

}];

}

你可能感兴趣的:(ShareSDK分享微博的问题)