App thinning without #3x images and when some images are JPGs - ios

For an upcoming update to one of my apps I have packed all the image resources into Asset Catalogs.
However, at the moment I do not have #3x version for most of my images. I have checked with the simulator and on iPhone 6 Plus #2x versions are used.
I don't mind this behaviour for two reasons:
The result is good enough for images which I am using
Only 50% of my users are using iOS 9. If I add #3x images the size of my app will skyrocket for those on older OS
Although images load correctly in the Simulator for iPhone 6 plus, I am a bit worried about what happens when I archive my app. In particular, I am afraid that with App Thinning iPhone 6 Plus users will get an app without any images :)
So, I have two questions:
If I do not provide #3x images will #2x be loaded on iPhone 6 plus
after my update goes live on the App Store?
Will I still benefit from App Thinning because users with #2x and
#3x displays will not be downloading #1x images (and vice versa)? Or will App Thinning not work in this case and users will get the same assets irrespective of their device's screen?
These are trivial questions, but I couldn't find info anywhere online as to what happens when you do not follow Apple's guidelines by not providing #3x images in asset catalogs but your app is still available for iPhone 6 +. In addition, some of my images are in JPG format which adds extra uncertainty because it is not an ideal format for iPhone.
Thanks in advance for any assistance!

I performed several additional tests using the procedure proposed by Matt:
When minimum deployment target is iOS 6 no Assets.car is being
generated. [UIImage imageNamed:] returns nil for JPG images unless ".jpg" extensions is provided as part of the image name
When minimum deployment target is iOS 7 Assets.car is generated but
it contains only those images which were imported in Asset Catalog
as PNGs. All JPGs get copied outside of Assets.car. [UIImage imageNamed:] returns nil for JPG images unless ".jpg" extensions is provided as part of the image name.
When minimum deployment target is iOS 8 Assets.car contains all
images. Its size is 13MB. [UIImage imageNamed:] returns JPG images correctly even when not specifying ".jpg" extension. Images also load correctly when ".jpg" extension is included
When minimum deployment target is iOS 9 Assets.car contains all
images. Its size is 11.5MB. [UIImage imageNamed:] returns JPG images correctly even when not specifying ".jpg" extension. Images also load correctly when ".jpg" extension is included
I have used the image extractor tool suggested by Matt to extract images from these Assets. I was only able to export from archives for devices which are with Retina and I can confirm that all images had correct resolutions (i.e. only retina size, iPad specific images ignored). The tool, however, saved all of them in PNGs format and so the resulting size of the folder was always bigger then Assets.car.
What is most surprising is that the size of the folder was the same (39.4MB) for cases 3 and 4. Also, the images seem to be exactly the same. So, I really wonder what happens there because there is a difference of 2MB in the size of Assets.car for these cases.
To conclude, we are still not sure if such testing method can be used to accurately mimic the App Thinning behaviour. So, if anyone had a personal experience with this it would be awesome if they could share it.
However, assuming that exporting for specific device for AdHoc produces the same result as actual App Thinning performed by App Store we can conclude that:
App thinning only kicks in when deployment target is iOS 7 or later
App thinning for JPG images only works starting from a minimum deployment target of iOS 8
[UIImage imageNamed:] returns JPG images correctly without providing ".jpg" extension only when JPG images are correctly processed through Asset Catalogs. Which, as mentioned earlier, only happens when minimum deployment target is iOS 8 or later
[UIImage imageNamed:] always loads correct images if ".jpg" extensions is specified.
The last two conclusions seem to be irrelevant to this question, but I have found several conflicting opinions on Stack Overflow about how to load JPG images correctly with Asset Catalogs. Some people claimed that you can load them without providing ".jpg" extension whilst others complained that this approach doesn't work. I think 3 and 4 above explain in details what is happening in this case and why people get different results.

Answer your own question. Archive the app. Export the app for the target device you're interested in:
Now look inside the exported app and see what resources it contains. An .ipa is just a .zip file by another name; it's easy to look inside it by changing the suffix. Now you know what resources an iPhone 6 Plus user will download from the App Store.

After getting iPhone4s and iPhone 6SPlus archive, from a project with missing 3x images
then using the image extractor tool suggested by Matt,
deployment target iOS 7
here's the result:

Related

Adding #2x and #3x pictures without 1x version

I've started developing an iOS app, adding pictures in resolution which is ok for standard retina screens. Now I want to add #3x pictures for iphone 6 plus and 7 plus. I don't want to include 1x version for older devices. I've renamed all image files to name#2x but these are not recognized in the project anymore. I was thinking that #2x name modifier will be ignored, but this is not the case. Do I need to explicitely add "#2x" in all places I'm referencing these pictures in the code? Or should I leave standard retina versions without any name change and these will be used anyway as #2x and only use #3x name modifier for higher resolution versions?
Use asset catalogs. See Apple Documentation
Then it's really easy to define 1x, 2x and 3x images by drag&drop. If you load the image in code by name (without scale) it works like a charm. If 1x is missing the next possible image will be used automatically.
You can import pdf-images or well known as vector-images as single vector in assets.Hence No need of 1x,2x,3x seperatly.
You can use Blade
Better asset workflow for iOS developers. Generate Xcode image catalogs for iOS / OSX app icons, universal images, and more.
with a definition file like this will generate all the images for you and put it in the right place
blades:
- source: store/slice1.png # this image should be the only image, and the biggest image you can use (typically for icons, 1024x1024)
mount: Project/Assets.xcassets/AppIcon.appiconset

Totally confused about app-thinning

From what I have been able to understand from Apple's documentation, there is a 100mb over-the-wire limit on downloadable apps from the app store.
Apple recently introduced 3x assets for iPhone6+, causing ridiculous levels of bloat in our applications. Thus, app-thinning... So the idea is, I add an asset catalog and put all my images in there, and then the app store will know when an iPhone 6+ user downloads the app, it will only give them the 3x and 2x versions (i'm assuming for zoomed / non-zoomed), and when an iPhone 6 user downloads the app, it will give them the 1x and 2x versions (i'm also assuming for zoomed / non-zoomed).
So the 3x users are really only saving space by not downloading the 1x size assets (which are small and insignificant). And the 2x users are saving space by not downloading the 3x size (which is significant)... However, my question is app-thinning is only available for iOS9.. So what does that mean?
An iPhone 6 user on iOS8 will not be able to download the app at all because they don't have app-thinning and therefore they would be downloading the entire collection of assets and it will exceed 100mb?
I am asking this question because I uploaded my cocos2d game build to iTunes Connect and it says its compressed file size is 172mb with a yellow exclamation point, so I am worried about this... In my case, I know the problem really comes from the 3x size art. I'm not currently using asset catalogs because cocos2d (v2.x at least) doesn't support them, and I don't want to bother adding support for that if it's pointless as I am thinking based on what I've described above...
App slicing takes place on the App Store Servers so devices running iOS 8 or earlier are still able to download apps, which have app thinning enabled.
The App Thinning Documentation states
Sliced apps are supported on devices running 9.0 and later; otherwise, the store delivers universal apps to customers.
If the size of the universal app exceeds 100MB, the user has to download it over WiFi. A method to lower the initial download size are on demand resources.
Note:
As the pixel density on the iPhone 6 Plus is higher than on other models, even when non-zoomed, only the 3x images are needed so the 2x images do not need to be downloaded so the iPhone 6 Plus users do save a little bit more.

how to use 3x size in iPhone 6/6plus

I have some image resources, such as toolbar-1#2x.png toolbar-2#2x.png toolbar-1#3x.png toolbar-2#3x.png, I find that the 3x images can't autosize for iPhone 6/6plus, how can I set the 3x size images for iPhone 6/6plus? thanks.
Just drag your images to your xcassets file in your project. Xcode handles all the sizing stuff.
Not really directly relevant but as a known issue, you cannot use jpg files in your xcassets file on iOS7.
I hope you know what is Images.xcassets , you should use asset catalog for adding all your 1x,2x and 3x images.
As per apple doc:-
An asset catalog can include:
Image sets: Used for most types of images, an image set contains all the versions, or representations, of an image that are necessary
to support various devices and scale factors.
App icons: App icon sets contain all the representations of the icon that iOS apps must provide to be displayed on a device’s Home
screen and in the App Store.
Launch images: Launch image sets contain all the representations of the static launch image that iOS apps must provide to be
temporarily displayed when the app is launched.

XCode Image dimensions #3

I have a general question about XCode / IOS. I know that i can upload several images for all IOS devices(original,#2,#3). I coded know a app and 30% of the time i needed for image processing. I want to understand the way, how XCode handles images.
My Question: Is it enough, when i just add a #3 image? Does XCode scale it down to all devices while building or does the device (iPhone) itself scaling the images down to optimized sizes while running the app?
Does the One-Image-Method cause performance problems on #2 and #1 devices or will IOS reject the app because of missing images for specific devices?
How are you handling this issue?
You have to include #1x, #2x and #3x in an asset catalog. iOS will then select the correct size for the device.
I personally use Asset Catalog Creator to create all my asset catalogs. It will resize and create all the files for you.
If you only use #3x, Xcode does not scale it down to all device. the device (iPhone) itself does not scaling the images down to optimized sizes while running the app.
This One-Image-Method cause does performance problems on #2 and #1 devices,you cannot see the picture on #2x or #1x devices.
IOS will most probably reject the app because of missing images for specific devices.
If your app is developed for all device , You have to include #1x, #2x and #3x. I use A Xcode plugin Named RTImageAssets to create all my asset catalogs.

Use JPEGs for Launch Images

This is related to Default-Portrait.png for iPad: any way to make the file size smaller?
Is there any way to specify a more efficient file format (like JPEG) for Default-Landscape.png
and Default-Portrait.png?
Yes it's possible to use jpg files as launch images. Just add "Launch image" key with the base filename (e.g. LaunchImage.jpg") to the Info.plist. Then add files to your project such as
LaunchImage.jpg
LaunchImage#2x.jpg
LaunchImage-568h#2x.jpg
and Xcode will pick them up.
However through personal experience I've discovered if you're supporting the larger iPhone 5 screen the App Store expects PNG format and uses the presence of PNG to determine iPhone 5 support and display of iPhone 5 size thumbnails on the store. Using JPG images will not show the app as iPhone 5 optimized in the app store (even though it will work fine on the device) so it is best to stick with PNG.
There is no way to use an image other than a png.
All launch images must be PNG files and must reside in the top level of your app’s bundle directory. Section: App Launch (Default) Images
Update: JPEG images to work and Apple's documentation no longer specifies that the images must be PNG files.
If you use xcassets, then since Xcode 6 you can use JPGs. However Xcode will still not let you drop JPGs into the LaunchImage folder. But you can do it in Finder. Simply drop your PNGs into that folder with Finder and then edit the JSON file changing all .png extensions to .jpg.
I haven't submitted an app to the store using this yet, but it works in the iPhone simulator at least.
Update: Doesn’t work on the device. I’ll leave this answer here anyway so people know that this technique was at least tried so the effort won’t be repeated.

Resources