原生页面分享出小程序页面,卡片没显示图片
发布于 5 年前 作者 mxiao 4425 次浏览 来自 问答
  • 当前 Bug 的表现(可附上截图)
  • 预期表现
  • 复现路径
  • 提供一个最简复现 Demo

NSData *tempData;
    UIImage *image = [self imageWithImage:miniThumbImage scaledToSize:CGSizeMake(250,250*5/4)];
    
    float i = 1;
    do {
        tempData = UIImageJPEGRepresentation(image, i);
        i = i-0.1;
    } while (tempData.length>128*1024 && i>=0.1);
    
    WXMiniProgramObject *object = [WXMiniProgramObject object];
    object.webpageUrl = url;
    object.userName = @"";
    object.path = miniPath;
    object.hdImageData = tempData;
    object.miniProgramType = WXMiniProgramTypeTest;
    
    WXMediaMessage *message = [WXMediaMessage message];
    message.title = title;
    message.description = description;
    message.thumbData = nil;
    message.mediaObject = object;
    
    SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
    req.bText = NO;
    req.message = message;
    req.scene = WXSceneSession; 
    [WXApi sendReq:req];

回到顶部