Reduce the size of executable in .ipa [duplicate] - ios

This question already has answers here:
How to reduce the size of my iPhone application?
(7 answers)
Closed 4 years ago.
Following this how to reduce the size of app
My ipa size is 19 MB . Renamed the file with a .zip extension and double click on it. Found the app in the Payload folder and right mouse click on it and choose show package contents. Found exec to be 25MB and some images of large size.How can I reduce the size of exec? because I want to reduce the size of app in store
Any ideas / suggestions would be highly helpful

You can load high-res images from internet
Optimize splash screen images, remove alpha, make 8bit 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 look through this question answers

look at this technical Q&A on Apple Developer site.
It should contain all tips for reduce your ipa size ;)
Below is an excerpt from that document that may get you started:
Measure Your App Before trying any optimizations, you should measure.
Some of the techniques in this document are tradeoffs with downsides
that must be considered. You must measure their impact to be sure
you're making the right tradeoff. Without measuring, you can't know
what kind of change you're making.
The app distribution process produces a number of different artifacts,
each with its own purpose and size. It's important to understand what
each artifact represents and which artifacts to use when measuring
your app's size.
An app bundle is the .app bundle containing all of the binaries in your app, plus all of your app's resources, such as images. This
bundle contains everything needed for your app to run on every
supported device. For the purposes of this document, an app bundle
only refers to the .app produced by archiving your app.
An App Store submission .ipa is created from an Xcode archive when uploading to the App Store or by exporting the archive for iOS
App Store Deployment. This .ipa is a compressed directory
containing the app bundle and additional resources needed for App
Store services, such as .dSYM files for crash reporting and asset
packs for On Demand Resources.
A universal .ipa is a compressed app bundle that contains all of the resources to run the app on any device. Bitcode has been
recompiled, and additional resources needed by the App Store, such as
.dSYM files and On Demand Resources, are removed. For App Store apps,
this .ipa is downloaded to devices running iOS 8 or earlier.
A thinned .ipa is a compressed app bundle that contains only the resources needed to run the app on a specific device. Bitcode has
been recompiled, and additional resources needed by the App Store,
such as .dSYM files and On Demand Resources, are removed. For App
Store apps, this .ipa is downloaded to devices running iOS 9 or
later.
A universal app bundle is the decompressed universal .ipa. The installation process decompresses the universal .ipa and installs the
universal app bundle.
A thinned app bundle is the decompressed thinned .ipa. The installation process decompresses the thinned .ipa and installs the
thinned app bundle.

Related

Not able to upload IPA after applying App thinning

I have applied App Thinning while creating IPA file in order to recuse the app size. The IPA files for iPhone, iPad are created successfully. If I try to upload the app with Transporter app, Im getting the following error.
Asset validation failed (90704) Missing App Icon. An app icon measuring 1024 by 1024 pixels in PNG format must be included in the Asset Catalog of apps built for iOS, iPadOS, or watchOS. Without this icon, apps cannot be submitted for review. For details, see https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/app-icon/. (ID: 39b914bd-2d61-4bfb-a021-fd6f542867c8)
Asset validation failed (90190) Invalid Info.plist Key. The key 'UISupportedDevices' in the Info.plist file is not valid. (ID: 4094654a-c9a0-4260-b46b-7fa61d062c16)
I have my 1024*1024 images available in assets catalog.
In my entire app there is no keyword "UISupportedDevices".
Not sure what exactly is the issue. Please help.
I've faced this issue in the past and I think what you are seeing may be due to an xcode issue with images having an alpha channel.
Try to remove alpha channel (see this answer for reference) from your 1024x1024 app icon asset. Replace your asset with this new image.
See if you're able to get your build through. If not, share the outcome here and we'll see where we get to.

App Icons Duplicated in Asset Catalog and Root Bundle Directory

I notice that when I use an asset catalog to specify my iOS app's icon, the resulting app has both an Assets.car file with the icons in it, as well as the individual icon files in the root bundle directory.
The app has iOS 9 as its deployment target.
I'm checking the resulting bundle by archiving the project and exporting it (via Xcode's Organizer window) as an Ad Hoc build with the App Thinning option set to iPhone 6s. This is on Xcode 9.3.1.
When I inspect the Assets.car file in the thinned app, I see that it only has the size 40, 58, 80, 114, and 120 icons (as well as a 200x178 image that the asset catalog viewer calls ZZZZPackedAsset-2.0 which contains 4 versions of the icon embedded in it which I've measured to be sizes: 42, 60, 82, and 116).
The icon files in the root bundle directory are the following:
AppIcon20x20#2x.png
AppIcon20x20#2x~ipad.png
AppIcon20x20#3x.png
AppIcon20x20~ipad.png
AppIcon29x29.png
AppIcon29x29#2x.png
AppIcon29x29#2x~ipad.png
AppIcon29x29#3x.png
AppIcon29x29~ipad.png
AppIcon40x40#2x.png
AppIcon40x40#2x~ipad.png
AppIcon40x40#3x.png
AppIcon40x40~ipad.png
AppIcon50x50#2x~ipad.png
AppIcon50x50~ipad.png
AppIcon57x57.png
AppIcon57x57#2x.png
AppIcon60x60#2x.png
AppIcon60x60#3x.png
AppIcon72x72#2x~ipad.png
AppIcon72x72~ipad.png
AppIcon76x76#2x~ipad.png
AppIcon76x76~ipad.png
AppIcon83.5x83.5#2x~ipad.png
So I have two questions:
Why are icon assets duplicated as external AppIcon*.png files and internal Assets.car assets?
Why do the individual AppIcon*.png include all of the icons and not just the ones need?
I was under the impression that iOS 9+ can use the asset catalog for its icon assets. Is this just a discrepancy in the bundle that Xcode produces versus what will happen on the app store? Or is it an incorrect assumption that I'm making about how the app thinning app export option works?
With regard to the app icons, the asset catalog is a human labor-saving device, not a space-saving device.
Historically, there were not always asset catalogs; instead, the iOS system on the device expects to find the app icons at the top level of the app bundle, with highly specific names derived from a name specified in the Info.plist.
You could configure that yourself, and that's what we used to have to do.
But to save you the trouble of worrying about that, you are offered the option to put the app icons in the asset catalog instead — and then the app-building process does for you what you would previously have done yourself, writing the icons out to the top level of the app bundle and modifying the Info.plist to point to them.

My App iPA file size is very big compare to android apk file

I am developing one app with ionic angular4 and while I am deploying my app my app size is very big.
My app is very simple informative app and there is only app icon and splash screen are there in my bundle still its goes up to 16-17 MB in iOS iPA while in android same thing will goes up to 3MB only so is there any way to decrese my iPA file size ?
Note : I am using production mode while deploying my app.
While I reverse engineering on iPA file I found below interesting things which may help me out from this issue.
www -> 10.9 (almost 65% of iPA size)
www/build -> 10.0 MB
www/build/vendor.js -> 4.3 MB
www/build/vendor.js.map -> 5 MB
May be we can workout on vendor.js will help us to reduce my App size. But not sure how can we reduce this file size ?
Thanks in Advance!
Almost I lose hope that I can resolve this issue and compromised with IPA file size.
Meanwhile, I developed 4-5 ionic based app with the same issue and in my recent app deploy I fond my IPA file with almost half of the old app size.
So I compare steps of old and new app deployment and I summarised below the solution is best practice.
Build your app in prod mode by using --prod.
Build Command : ionic cordova build ios --prod
Compress all your images with the best resolution and without compromising your image quality. (Use some tool to compress and decrease your image size e.g. ImageCompress).
Remove unwanted files which are no more useful in prod ready code like Sample or dummy JSON, String, PDF, Images.
Following the above steps, My Old APP IPA file size decreased by 60% and now app IPA file size is only 6 MB earlier it was 16 MB.
This will help to reduce app build size.

Big size on iOS App Store

i am using Unity 5.3.1f1 and make game for iOS, after my game is done i build it to XCode. The binary archived from XCode, and generate ~65MB IPA file. Terrifically, after i upload that IPA file to the app store, it becomes larger ~150MB.
I have read this thread:
http://answers.unity3d.com/questions/1149641/very-large-ios-build-size-unity-5.html. But in those case, their IPA file itself is large, and i already disable bitcode
Do you guys have any suggestion?
By assuming you're ok with ~65MB file, i can say there is nothing you can do about it. App store shows install size of your game which is a lot larger than size of compressed IPA file.
For instance, while my game's IPA file size is ~95MB its size on app store appears as ~300MB. In case it helps, please see my earlier question.

How to build an application including a folder for further load on the device?

I have a directory structure on my computer i wanted to include into my app bundle:
#"/Users/playra/Desktop/2 DivyaLoka/Собрание Тайн";
application starts surf folders, keeping the directory tree, which is visible in the screenshot
but when using the load
self.pathProperty = [[NSBundle mainBundle] resourcePath];
or
self.pathProperty = NSHomeDirectory();
structure disappears and everything is loaded into one tableView.
How to start an application starting with a folder **Собрание Тайн** that is in the sandbox keeping structure inside for further load on the device?
First choose IOS Device
Product --> Archive
Choose Disribute
Then, Save for nterPrice or Ad-hoc Deployment
Then choose your certificate and Export
Then save the build

Resources