How to reduce archive size in iOS - ios

So I have just shocked that I ran out of space in my Mac book, then I try to find out what really fills up my space. This machine is only used for iOS app development (react native 0.64), and one thing that I also tried to do is cleaning up the archives of my Xcode. To my shock, like every single archive is taking 1.5GB space, but the app itself only like 20MB in play store. So I guess every single archives also contains extra data that I'm not sure important or not.
another thing that I notice is that the app archiving can take around 30 minutes alone, while the android release build only take 3 minutes to build an the .apk size of android is only 30MB.
My question here is:
how to somehow reduce the space taken by archive?
if no. 1 doesn't work, how to auto delete archive after upload to TestFlight or play store?
is there a way to reduce the archiving time taken?

To delete unused XCode data in iOS, I am using DevCleaner (that is set to remove archives/build data every week automatically):
https://apps.apple.com/us/app/devcleaner-for-xcode/id1388020431?mt=12

you can delete this folder every now and again to get more space
/Users/user/Library/Developer/Xcode/DerivedData
use fastlane to make builds much faster and you can automate a whole bunch of processes
this tutorial is dated but I still use it as a reference
https://docs.fastlane.tools/getting-started/cross-platform/react-native/

Related

Xcode Archive Is Too Large

I have a Unity3D project that I've already released for iOS via Xcode. Previously the archive size was about 30-40Mb which I'm happy with.
I've now changed a few things within the Unity project, and rebuilt it for Xcode. Now when I archive it, the size is around 110Mb, which is huge compared to the previous file size. I only changed the logo, and splash screen design.
Also, when I rebuild the older version, the size isn't 30-40Mb anymore, it's 110Mb too!
So I'm guessing this is something to do with the new Xcode for iOS8? Not 100% sure, hence why Im asking.
Thanks.
Try to turn off BitCode. Open XCode => Build Settings => search Enable BitCode. Set it to No.
Have you read this?
http://docs.unity3d.com/Manual/iphone-playerSizeOptimization.html
Also it can be fault of stripping level, try to use micro mscorlib.
In addition you can take a look at Decrease Your App’s Code Size from Mac App Programming Guide.
https://developer.apple.com/library/mac/documentation/General/Conceptual/MOSXAppProgrammingGuide/Performance/Performance.html#//apple_ref/doc/uid/TP40010543-CH9-SW2
I believe part of what is happening here is the additional overhead for the arm64 slice (unless you were already including the arm64 slice previously). I would not expect that much of an increase in size for the arm64, but it would still be roughly X2 on the app binary (minus the resources).
As of Feb 1, Apple requires arm64 support as well as the app being built with the iOS 8 SDK. The default Xcode build setting enables arm64.
What you can do is Show Package Contents on the xarchive and work your way to the app executable binary. You can then compare the size difference on the app executable binary from before and now. You can also run lipo -info on it to see all the slices from before and now. Note I am assuming you have an older xarchive to compare with.
I would then probably diff the rest of the resources (use something like Araxis merge) to see the differences in the files. This will let you see what resource files changed or got added. If your diff is only the executable, then you have isolated were the size difference has come from.
The 'Estimated App Store Size' reflects the installed app size, not the download size.
I'm basing this off the following test:
(Unity app build) Estimated App Store Size: 140.8 MB, size listed in store: 33.4 MB. The splash images alone inside the package add up to 30 megs uncompressed (all my jpegs were converted to pngs) so there's no way the installed size is 33.4 MB. After install, if I go to settings -> general -> usage -> Manage Storage I see the app is 141 MB installed.
I'm not sure how to estimate the download size, which is what matters if you have an app you want to be downloaded over cellular network and needs to be under 100 MB downloaded.
I added this as a comment to the question, but I wish I had read this as an answer, so here it is.

optimize build time of iOS projects with large database

I am developing an app which itself is small (~20m) and builds fast on the simulator, but comes with a large database (~800m) and takes a long time to build on a device. It seems the majority of time is spent on copying(verifying) files in the database which never change. Is there a way to reduce/skip this step and accelerate the build?
Maybe while testing you could put the database in the Documents folder and copy it through iTunes or drop the files in the right folder on the simulator.
I think that way Xcode won't need to copy the file to the device, but of course it makes for a slightly more complex setup on the first run.

Distribution Validation Failed for iOS App Submission

So I am in the process of submitting my first application to iTunes, I went through the entire process, and when I clicked distribute on my archive so that i could submit my app for approval, I got this image saying that a certain amount of things have failed. I fixed all the app icons that were missing (I didn't know that you had to have all of them, but I have them all now).
If possible, could you guys explain what each one means and how to fix it (I'm having a very large problem here since my app is actually part of a school project due in two days).
Are you including large files with your application? In the Xcode Supporting Files folder, right-click on each file and select Show in Finder to see the size of each file. Are the biggest files absolutely necessary or a duplicate of another file?
Are there large arrays with several thousand or more elements within your code? Could the data be placed on a server external to your code and read in?

Xcode 4.2 "Run on device" performance with large app caches

I've developed an iOS 5 application with a rather large cache stored in /Library/Caches. I've noticed that running the app on an actual ipad is getting very slow. As in 5 minutes or so just to launch the application. Without Xcode, the application launches quickly. There seems to be a correlation between the size of the cache and the amount of time it takes to run the application, as the application starts quickly with a minimal cache.
I'm assuming that Xcode is making a backup or something silly like this. Has anyone else experienced this, and if so is there a workaround?
EDIT: (for clarity)
The structure of /Library/Caches/ is:
./big_ass_image1.png
./big_ass_image2.png
...
./big_ass_imageN.png
I simply read them in with coregraphics at a later time. The issue is the speed at which Xcode actually runs my app on the ipad. It's upwards of 4 minutes, which makes on device development very difficult. I would use the simulator, but it's precisely these big data sets that need to be tested on device.
EDIT: (how the files get there)
The files get into the cache via downloading. And sadly, there's no way to limit the cache size (at least not at the 2 gigabyte level).

PNG-images turn blank/corrupted after build and archive

I ran into a strange problem today, after renaming a couple of images in my app and making sure they work on a device as well as the simulator, I used Build and Archive as I always do to build my app to distribute to the testers.
However, this time I got strange reports from the testers saying the images were gone, so I installed the build on my phone and to my surprise they were gone as they said. Tried to do a clean and build again but no change.
When I open the .app archive I can clearly see that many, but not all, of the images have turned blank, they appear to be the same physical size on the disk and they also seem to have the correct height and with when I press space to preview them, I can't however open them with photoshop for example (the file-format module cannot parse the file).
This is very confusing and as I have to get the build ready for testing very soon I would very much appreciate some help in this matter.
Your source PNGs seem to be slightly off-standard or at least incompatible with Apple's pngcrush. Make sure you use a commonly well functioning tool for creating the PNGs - when in doubt reconvert/resave them.

Resources