Device specific Graphics for Universal iOS app - ios

I've configured my app as Universal in Target/General/DeploymentInfo
Is it ok to make device specific assets in the xcassets file for iPhone and iPad, even though the app as a whole is Universal? It seems to work, but I'm worried if there is some catch.
Background:
I plan to add 2X and 3X versions of some assets in the 2x and 3x boxes in the iPhone section, and 2X and 4X versions in the 1x and 2x boxes in the iPad part. I use a capital X to describe the scale of my assets.
Note, that the 2X asset will be used twice. Both in iPhone and iPad. Maybe there's a way around that?

Nothing wrong with this at all.
Where I work, we've done this for our games: different asset bundles are downloaded depending on the device the game is running on.
This allows us to adjust for older hardware, like iPad 2.

Related

Assets.xcassets - Universal not working

I am using Universal for Assets.xcassets in the hopes that I only have to create 3 different sizes for each image I use. But, despite Assets.xcassets telling me that my images are Universal in the Attributes Inspector, when I test on my iPad, the images are blurry and aren't as sharp as they are on my iPhone, making me question why there is a Universal option.
I've double checked all my images and they are all correctly sized.
My questions:
In the Attributes Inspector, under Universal, there are iPhone and iPad options. In order for my iPad to provide crystal clear images, should I use the iPad option?
And if I should: What's the point of the Universal option if it doesn't really do its job?
Also if I should: What size images do I use. The iPad option gives me the options of 1x and 2x size images. So, should the size of the 1x image for iPad be the same size as 1x image for Universal?
Thanks in advance.
Universal merely means that this app will run on iPad and iPhone natively. Thus the devices on which your app might run can have a single-resolution, double-resolution, or triple-resolution screen.
If you have checked Universal, accordingly, you should see three slots:
Your job, therefore, is to make three versions of your image, sized in proportion. If the 1x is 100x100, the 2x should be 200x200 and the 3x should be 300x300. The version in the appropriate slot will be used at runtime in accordance with the screen resolution of the device we're running on.
The asset catalog does not do any image sizing for you. You have to do it beforehand. (I find Graphic Converter a nice utility for this purpose.)
You could just supply a 3x image and allow the runtime to size down for you, but this is a waste of memory; Apple specifically advises against this in one of the WWDC 2016 videos. So just bite the bullet and make all three image sizes yourself.
Finally:
when I test on my iPad, the images are blurry and aren't as sharp as they are on my iPhone
Hmm, the only reason I can think of for this is that your app is not running natively on the iPad, but is an iPhone app running in "emulation mode" on the iPad. If that's the case, nothing you can do is going to make it look really good. It would be better to write your app as a true Universal app. That is a setting that you make when you create the project initially (though it can be changed later by editing the app target).

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.

do I need to include #1x images of app only runs on iphone 4s and above?

Is this still necessary? 2x and 3x seem to be the only images I need based on models I support. What is the correct approach?
If your app is targeted for iOS9 or less then you still have to build for the iPad 2 which does not have a retina display.
http://www.evad3rs.net/2014/10/ios-9-supported-devices-compatibility.html
Even if you're building an iPhone only app they will run on an iPad.
You cannot restrict your app by device. So if you're supporting iOS9 or less (which is every OS version) then you should include #1x images for this reason. If you don't then the #1x devices will just display scaled down versions of the #2x images so you don't NEED to include them... but you should.
What you can do instead (which is something that I have been doing more and more recently) is to use an app like PaintCode. This will take your images and turn them into code. This code is then imported into your project and the images are generated at runtime by the code. They are completely resolution independent and it reduces your app bundle size as you don't have to bundle in any images.
According to IOS Human Interface Guidelines all IOS high resolution devices below IPhone 6, use 2x form of images. So if your app will not run for non-high resolution devices, I am guessing you don't have to add 1x version of images.
Here's the thing, apple reviewers always test your app on the latest and greatest device. They will certainly test your app on BOTH iPhone and iPad using the latest hardware. They don't have time to regression test your app on every possible device (ipad2, iphone3, iphone4, iphone5 etc). Your users on the other hand will let you know when things don't work as not everyone is on the latest hardware.
Now when you create a project you are required to provide icon images. I am sure you know this screen in Xcode. You can see there are places for 1x images. What happens if you don't provide 1x images? Go ahead, archive the project and try to upload to itunesconnect. You will most likely get a validation error that certain images are missing.
Like other said you cannot restrict your app from running on iPhone 4 Vs iPhone 4s and your binary will be stopped from upload if any required images are missing.

ios, publish different build per device

Google Play allows different apks per screen density, does Apple Store support this?
I'm sure the info is somewhere, but all I find when I search are people asking how to develop one app to support all devices.
I know how to do that already, but this specific (top secret) project will be 1000 times better if I can release one super optimized version for each screen resolution... but I'll settle for density or device (generation and type) if needed.
I don't have access to XCode (no Mac) to check options currently.
Bonus points: If possible, is Apple going to frown on this and possibly reject my app because of this?
This can't be done. If your app supports the iPhone then it must support both 4" and 3.5" inch iPhones. If it supports only iOS 7 then you can avoid non-retina devices because only retina devices can run iOS 7.
But if you support the iPad you must support both retina and non-retina.
You can have one app (Universal) that does it all or you can have separate iPhone and separate iPad apps. But the iPhone app must support both sizes and possibly both types (retina and non-retina) of screens. And the iPad app must support both types of screens.
Apple won't accept apps that don't support the differences.
It should also be pointed out that in the Interface Builder part of Xcode, you setup the UI with points and not pixels. So, for an iPad, when you place a button, you do not have to specify retina or not. On a Retina screen a point is 2x2 pixels and on a non-retina screen a point is 1x1 pixels. Also, with image assets, you have a single image asset you ask for in code, but you add multiple copies of the image in the image assets. Like the retina and non-retina copies. If you have an image named cat.png, for retina this would be cat#2x.png and for non-retina it would be cat.png. But, in code or the inspector you would reference it with imageNamed:#"cat" and Objective-C is designed to handle the rest.

Optimization of iOS6+ images game

I have a game on the Apple Store, we make it to iPhone with retina & non-retina images. We are exporting to iPad and making it universal app.
But the main problem it's that the app its 45MB without iPad with iPad retina & non-retina, I think will get more than 100MB
I was thinking removing the normal images and leave the #2x as the normal images. And for preventing 3GS devices I upgrade it to iOS7.
What do you think? or how do you solve this issues in your games?
Note: we have the app in spanish & english, and because we render some text with shadows and stuff, we add it as images, so in some cases we have 8 assets per image :S
Thanks!

Resources