首先要去集成相关的第三方库,这里不再多说. "WXApi"
WXMediaMessage *message = [WXMediaMessage message];
WXImageObject *ext = [WXImageObject object];
//img 分享的图片
NSData *imageData = UIImagePNGRepresentation(img);
//缩略图
UIImage*tubmbImage = [selfscaleImage:imgtoScale:31 *1024];
ext.imageData= imageData;
// 缩略图 小于32KB
message.mediaObject= ext;
[messagesetThumbImage:tubmbImage];
SendMessageToWXReq *sendReq = [[SendMessageToWXReq alloc] init];
sendReq.bText=NO;
// scene 0/1 好友/朋友圈
sendReq.scene= 1;
sendReq.message= message;
[WXApisendReq:sendReqcompletion:^(BOOLsuccess) {
}];
网友评论