微信SDK 在iphone 6plus上分享失败(ios自学笔记)

最近在做微信分享,出现了一个非常奇怪的实情

点击进入微信分享后除了 6plus以外的所有机型都可以分享

但是6plus点击微信分享图标没有反应(对于同一个牌子不同型号效果不一样的问题一贯是比较麻烦的)

经过反复检查,微信sdk对于分享的图片大小是有限制的 sdk上面标注的是32K,但是实际上,6P真分享32k的图片有时候还是分享不出来。

    NSURL *imageURL = [NSURLURLWithString:[shareDicobjectForKey:@"image"]];

    NSData *imageData = [NSDatadataWithContentsOfURL:imageURL];

    UIImage *image = [UIImageimageWithData:imageData];

    

    CGFloat resizeHeight =100.0f;

    CGFloat resizeWidth = (image.size.width * resizeHeight) / image.size.height;

    

    UIGraphicsBeginImageContextWithOptions(CGSizeMake(resizeWidth, resizeHeight),NO,0.0);

    [image drawInRect:CGRectMake(0,0, resizeWidth, resizeHeight)];

    UIImage *resizedImage =UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    

//这里是把图片压缩到原来内存的百分之多少    0.1就是百分之十

    NSData *lowImageData =UIImageJPEGRepresentation(resizedImage,0.1);

    CGFloat F = lowImageData.length;


//这里我是经过多张图片测试才得到的一个值

    if (F >16900) {

        UIImage *lowImage = [UIImageimageFromBundlePath:@"Images"andName:@"Icon-Small-40.png"];

        [message setThumbImage:lowImage];

    }

    else

    {

        UIImage *lowImage = [UIImageimageWithData:lowImageData];

        [message setThumbImage:lowImage];

    }

    

    if(_scene ==WXSceneTimeline)

        message.title = [NSStringstringWithFormat:@"[哦时尚] %@" ,[shareDicobjectForKey:@"description"]];

  

    WXWebpageObject *ext    = [WXWebpageObjectobject];

    ext.webpageUrl          = [shareDicobjectForKey:@"url"];

    

    message.mediaObject     = ext;

    message.mediaTagName    =@"";

    

    SendMessageToWXReq* req = [[SendMessageToWXReqalloc]init];

    req.bText =NO;

    req.message = message;

    req.scene =_scene;

    [WXApisendReq:req];


代码上传后,6+就可以直接分享了

微信plus分享失败

微信6plus上分享失败

微信在6plus上分享失败

微信iphone6plus上分享失败

微信SDK在iphone6plus上分享失败

你可能感兴趣的:(iOS自学笔记)