NSArray* imageArray = @[[UIImage imageNamed:@"icon.png"]];
if (imageArray) {
NSMutableDictionary *shareParams = [NSMutableDictionary dictionary];
[shareParams SSDKSetupShareParamsByText:@"魔印plus一款好用的3D打印輔助軟件"
images:imageArray
url:[NSURL URLWithString:@"https://itunes.apple.com/app/id1206801920"]
title:@"魔印plus"
type:SSDKContentTypeAuto];
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"456" ofType:@"mp4"];
[shareParams SSDKSetupWeChatParamsByText:@"本地視頻分享。。。"
title:@"視頻分享"
url:nil
thumbImage:[UIImage imageNamed:@"icon.png"]
image:[UIImage imageNamed:@"icon.png"]
musicFileURL:nil
extInfo:nil
fileData:nil
emoticonData:nil
sourceFileExtension:@"mp4"
sourceFileData:filePath
type:SSDKContentTypeFile
forPlatformSubType:SSDKPlatformSubTypeWechatSession];
//2、分享(可以彈出我們的分享菜單和編輯界面)
[ShareSDK showShareActionSheet:nil //要顯示菜單的視圖, iPad版中此參數作為彈出菜單的參照視圖,只有傳這個才可以彈出我們的分享菜單,可以傳分享的按鈕對象或者自己創建小的view 對象,iPhone可以傳nil不會影響
items:nil
shareParams:shareParams
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];
[alertView show];
break;
}
case SSDKResponseStateFail:
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"分享失敗"
message:[NSString stringWithFormat:@"%@",error]
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil, nil];
[alert show];
break;
}
default:
break;
}
}
];}
參考地址http://blog.csdn.net/qq_33777090/article/details/51282547