I am working a kids app. It has number of video files and png files. All to gather came to size of 1.6GB after compressing. Is there any way to reduce the file size to use in app.
try compress your image resources.
imageOptim is good choice.
some kind of unnecessary resources, you can make it to download. Video always the hard-disk space killer, put it in the server, if you want to display it, request it and download it as cache.
Related
we have implemented one universal application. It's a huge application and 6-8 SDKs are integrated, So the entire app is taking around 40MB size.
After all, we want to reduce the size of the application. So we started the investigation, where exactly it is taking more size. What I know is, I can check for useless view controllers, and I can remove 1x images. And these things we can do in Xcode. But what if we want to know the sizes it is taking in .ipa file itself. Is it possible ?
But is there any better way to know the .ipa size module/ SDK wise. Please let me know. Any optimisation tool are available ?
The following post has good advice on optimizations
https://medium.com/#mandrigin/ios-app-performance-instruments-beyond-48fe7b7cdf2#.btdp7bv5t
Also, you can try to access images in the IPA file using such tools like iBrowse and even better if you have a device with a firmware less than 9.3.3 to perform a jailbreak and investigate.
You can go even deeper by:
reducing image size using tools like imageAlpha & imageOptim which are both free
take a look at webP image format developed by google
https://developers.google.com/speed/webp/#webp_support_stylefont-weight_bold
What would be the best way to include a lot of images in the bundle? I have an index of (game) items thus about 4000-5000 image files (total 27mb so not that big). Just include the whole map in the bundle or maybe first write a script that converts them to NSData? I could imagine there would be a smart way to do this so the app wouldn't have to look through all images individually to find a single one. Would love to hear your thoughts.
27mb isn't a huge amount to download so the easiest option would be to put them in an asset catalog, as Ryan Heitner mentioned in his comment this will allow App Thinning to take place in iOS 9.
I'm not sure what you mean by this:
I could imagine there would be a smart way to do this so the app wouldn't have to look through all images individually to find a single one
Each image will need to have a unique name (this is true regardless of the number of assets you have) and your code references the images by that name so it won't have to "look through all images individually to find a single one".
Alternatively if you really want to reduce the initial download size you could use On Demand Resources (another upcoming iOS 9 feature) to store them on Apple servers and loaded on demand in your code. Presumably you won't be targeting only iOS 9 though so in this case you would need to host the resources yourself and load them using standard techniques (see here, here, here, or use a library.
You should pack them in a texture atlas.
Then, the texture atlas files should be imported in your bundled via a folder reference (blue folder icon) and not a group (yellow folder icon).
Images imported in bundle in folder reference won't be optimized be Xcode on packaging. So you can make your own file optimization using imageOptim. It can compress a lot more than what Xcode can do on JPEG and PNG images.
Hi guys I have a media heavy app for the iPad and my archive is ~370mb. For what I'm doing, that isn't unreasonable. If i view the xcarchive in finder it is ~391MB, the .ipa is ~388mb, which roughly corresponds to the size of all my assets uncompressed.
So I double-checked the actual usage on my test device and it is 755 megs! This is similar to the "estimated app store" size shown in organizer.
I checked usage on several other test devices and it is the same.
I read the other posts about the organizer estimate tending to be inaccurate, but does that translate to the usage indication on the iPad itself? Shouldn't the iPad just report how much actual space is being used?
370 mb (double) of extra usage can't be anything to do with the executable not compressing, and this shouldn't be a result of PNGs being somehow expanded, I use a ton of jpegs because they are so much smaller.
And the whole compressed/uncompressed discussion feels like a red herring because if I simply get info on the uncompressed assets folder in finder, it is ... 355 mb. So I can't understand how compressing and then uncompressing a bunch of images would double their size.
My only theories are:
- The usage on the development iPad is for some reason no indication of final app size
All my jpegs are somehow being converted to PNGs inside the ipad itself ... ??? really how is that possible??
I have two video files, they could somehow be automatically converted to another format .. ??again, really?? that sounds impossible
the app has in-app purchase capability, it could be somehow allocating disk space in anticipation of future purchases?
I hate all of those theories because none of them make sense. Any of you ever run in to this before?
So write some code in your app that after launch uses nsfilemanager to walk your complete app on the device (or simulator)and tally the totals and log it. This way you will know exactly. Also recall that the file system uses discrete disk blocks of fixed size so 1 byte files actually consume more, but this is probably not your problem.
Also zipping media rarely results in space savings.
This is similar to the "estimated app store" size shown in organizer.
You can check out why by examining the contents of your archive:
Open Organizer, select Archives, select your app, right click on your archive, Show in Finder, right click on the file, Show Package Contents, open Products, open Applications, right click on your app bundle, Show Package Contents.
Also, Xcode might combine retina and non-retina images into a single multipage TIFF file. Check out this answer for more details.
I have 3000 small sized audio files in my iphone project. File sizes are generally between 1kb and 50kb. I copied all files to one directory and I can play them. To decrease project size what should I do? What about compressing files to a zip file and then unzip on iphone for the first run? Is there any way to combine all of these files and play from one file? What is the ideal solution?
If your files are mp3s, there is little chance that you could make them smaller by compressing them. Indeed, mp3 is a format that allows you to obtain very high compression rates.
What you could do is reducing the encoding, and you could get a substantial gain. E.g., if your files are 256kbps, you could go to 192, or 128... another option that would provide a huge advantage is converting the file to a mono audio file.
I am not saying that all this could be done sensibly for your app, they are just options.
In any case, I would not be too much worried at the 20MB, and you can surely keep all of those files in the resource directory of the app.
I am developing app for studying foreign languages, and I'll need to ship 80000 little audio files in my app.
To reduce the size of my app I decided to ship only part of them in the bundle, on the zip archive, and then un-archive it to documents directory. Then, when iPhone will be in Wi-Fi network, I'll little by little download all the others.
But the problem is that Apple says, that we are not allowed to store big files in the Documents Directory. Flagging files for not backing up works only since 5.0.1
So I see two ways for me:
Ship all the files without zipping them and storing them in the app bundle – but that's too huge.
Ship a zip, un-archive it to the cache directory and then check, if they are (not deleted by system), and download one, if it's removed.
What should I choose or is there any other way for me to work it out?
Zipping audio files isn't a good way. I'm sure that saved space will not play any role.
Best solution is to use AAC encoded audiofiles.
Choose suitable quality between 64-128 kbps. And probably mono.
iPhones 3Gs and higher have hardware support for this codec.
There isn't much point in zipping files in the app bundle if you will just decompress them to the documents directory. When app bundles are delivered to iOS devices from the app store they are zipped up anyway (.ipa file), so unzipping to documents will make your app actually take up much more space on the user's device (once in the app bundle and once in the documents directory).
Automated way:
If you want to download them without using too much documents space you can write a predictive cache which has a maximum allowed size. You can keep track of when each file was last accessed and when you need to download a new file remove the oldest-accessed files until you have enough space. Your app can predict which files are needed next based on progression through the lessons, but even if they access a not-present file you can download it just-in-time and add it to the cache for future re-use.
Manual way:
You could provide a user interface to show the user how much space the different lessons are using and split it into lesson packs. Allow the user to control which packs remain cached and show how much space they use. They can decide when to download new packs as they progress through the lessons and when to remove old ones (if they want to save space). If the user wants to keep the files locally then you should let them, even though it uses lots of documents space.