iOS分享图片及小程序问题,为何分享图片的时候也会关联小程序?
我在从iOS分享图片到小程序的时候,会跳转两次。第一次是链接小程序的界面(如图),load结束后会跳回App,然后又自动跳回微信才是成功的分享图片界面,请问是什么情况?
背景如下:
app是有关联小程序的,也执行过WXApi 下面这个方法了;
+ (BOOL)registerApp:(NSString *)appid universalLink:(NSString *)universalLink;
小程序只发布了体验版,正式版尚未发布;
分享图片的时候代码如下:
+ (
void
)shareImageWithWeChatWithType:(
int
)scene
image:(UIImage *)image
completion:(
void
(^ __nullable)(
BOOL
success))completion {
if
([WXApi isWXAppInstalled] && [WXApi isWXAppSupportApi]) {
// 压缩图片小于10M
NSData * imageData = UIImageJPEGRepresentation([SZUtils compressImage:image toByte:10485760], 0.7);
WXImageObject *imageObject = [WXImageObject object];
imageObject.imageData = imageData;
WXMediaMessage *message = [WXMediaMessage message];
// 压缩图片小于32kb
[message setThumbImage:[SZUtils compressImage:image toByte:32768]];
message.mediaObject = imageObject;
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
req.bText = NO;
req.message = message;
req.scene = scene;
[WXApi sendReq:req completion:^(
BOOL
success){
completion(success);
}];
}
else
{
[SZUtils showAlert:@
"请安装微信"
okBtn:@
"确定"
result:^(NSInteger index) {
}];
}
}