iOS   发布时间:2022-03-30  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ios – 减少.ipa中的可执行文件的大小大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
参见英文答案 > How to reduce the size of my iPhone application?                                    7个
how to reduce the size of app之后

我的ipa大小是19 MB.使用.zip扩展名重命名文件,然后双击它.在Payload文件夹中找到应用程序并右键单击它并选择显示内容.发现exec是25MB和一些大尺寸的图像.我怎样才能减少exec的大小?因为我想减少商店中app的大小

任何想法/建议都会非常有帮助

解决方法

>您可以从互联网上加载高分辨率图像
>优化闪屏图像,删除alpha,制作8bit颜色
>使用伪AJPEG image.png image_mask.jpg

#define maskedCacheStorePath [[NSSearchPathForDirectoriesInDomains(NSCachesDirectory,NSUserDomainMask,YES) objectATindex:0] StringByAppendingPathComponent:@"maskedImageCache"]

+ (UIImage *)maskedImagenamed:(NSString *)imagename useCache:(Boolean)useCache {
    NSString *imageCacheStoreFile = nil;

    if (useCachE) {
if (![[NSFileManager defaultManager] fileExistsAtPath:maskedCacheStorePath])
    [[NSFileManager defaultManager] createDirectoryAtPath:maskedCacheStorePath withIntermediateDirectories:YES attributes:nil error:nil];
imageCacheStoreFile = [maskedCacheStorePath StringByAppendingPathComponent:[NSString StringWithFormat:@"%@.png",imagename]];
if ([[NSFileManager defaultManager] fileExistsAtPath:imageCacheStoreFile])
    return [UIImage imageWithContentsOfFile:imageCacheStoreFile];
    }

    UIImage *image = [UIImage imagenamed:[imagename StringByAppendingPathExtension:@"jpg"]];
    UIImage *mask = [UIImage imagenamed:[[imagename StringByAppendingString:@"_mask"] StringByAppendingPathExtension:@"png"]];

    CGImageRef ref = CGImageCreateWithMask(image.CGImage,mask.CGImagE);
    UIImage *result = [UIImage imageWithCGImage:ref scale:image.scale orientation:image.imageOrientation];
    CGImageRelease(ref);

    if (useCache && result)
[UIImagePNGRepresentation(result) writeToFile:imageCacheStoreFile atomically:YES];

    return result;
}

也看看this question答案

大佬总结

以上是大佬教程为你收集整理的ios – 减少.ipa中的可执行文件的大小全部内容,希望文章能够帮你解决ios – 减少.ipa中的可执行文件的大小所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。