Reduce the size of the executable in .ipa

After that, how to reduce the size of the application

My ipa size is 19 MB. Renamed the .zip file and double click on it. Found application in Payload folder and right click on it and select display package contents. Found exec to be 25MB and some large images. How can I reduce the size of my exec? because I want to reduce the size of the app in the store

Any ideas / suggestions would be very helpful

+3


source to share


2 answers


  • You can download high resolution images from the Internet.
  • Optimize splash images, remove alpha, make 8-bit color
  • Use pseudo-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;
    }
    
          

    also see this question for answers



+1


source


check out this technical Q&A on Apple developer site .



It should contain all the tips for reducing the ipa size;)

0


source







All Articles