在有圖片鏈接的時(shí)候,分享到微博,不像qq/微信那樣直接帶有鏈接,鏈接必須加到text里面,所以在保證彈出sheet的同時(shí),將新浪微博的分享內(nèi)容和其他平臺(tái)區(qū)分開(kāi)。

不說(shuō)了,貼代碼
//創(chuàng)建分享的參數(shù)
NSArray * imgArr = @[@"https://www.jingchujie.com/dybuat/css01/img/loginNew.png"];
if (imgArr) {
NSMutableDictionary * shareDic? = [NSMutableDictionary dictionary];
[shareDic SSDKEnableUseClientShare];
NSString * text = @"邀請(qǐng)好友注冊(cè)有獎(jiǎng)勵(lì)哦~";
NSString * content = [NSString stringWithFormat:@"%@%@",text,_urlstr];
[shareDic SSDKSetupShareParamsByText: ?text?
?images:imgArr url:[NSURL URLWithString:_urlstr] title:@"一起來(lái)吧!" type:SSDKContentTypeAuto];
[shareDic SSDKSetupSinaWeiboShareParamsByText:content?
title:@"一起來(lái)吧!" 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;
}
}];
}