How to activate "Optimized for iPhone 6 / iPhone 6 Plus"

Andreas, in the test project I built after downloading the stuff from github, my image keys read:  image=“Image” without me editing it.  On the step where you open the “Images.xcassets” did you right-click and add a new Image set?  Unless you rename it, it will be called “Image”  Once you have that, you drag your three images into the boxes.  Go back to the imageView in the story board and click on it.  Then set “Image” as the image that feeds the imageView.

If we missed a step in the tutorial, then we need to fix it, but having to edit the XML isn’t the step we missed.

Rob

Rob and all who helped - Thanks for making this idiot proof!   

Hi Rob,

yes, you are right, there definitely is an easier way than to edit the XML.

The problem in the tutorial is that you use images called “Splash.png”, “Splash@2x.png” and “Splash@3x.png” in the example.

But this won’t work, because in the XML there still would be a reference to the image set called “Image”. So the “Splash…”-images will never be displayed.

But - for an easy solution - everybody can just use “Image.png”, “Image@2x.png” and “Image@3x.png” as splash screens, and all is fine.

Or, let me suggest to put in a step 6b:

6b. Click on the “Image” item in “Images.xcassets” and rename it to the base name of the splash images you want to use, e.g. rename it to “Default” when you plan to use “Default.png”, “Default@2x.png” and “Default@3x.png” as splash screens.

And change step 10:

10. Click on the  Image  pull-down and choose  Default.

After this the reference in the XML goes to “Default” (or whatever you prefer to use) and you don’t have to edit the XML file.

Best,

Andreas

I tested this as is on my iPhone and iPad.  I didn’t have to do anything.  I think the .nib file gets compiled with everything filled out correctly.  Yes, I used “Splash.png” because I was using the black launch screen and just chucked those images in there because it’s what I had.  I specifically did not use the Default*.png images as the idea is that you would design your own launch screen and move away from the static images (which of course still need to be there for older OS’s).  You of course should be able to use the Default.* images if you want.

Rob

Hi Rob,

hm, it seems I just cannot get the problem across, maybe the language barrier, I’m German after all. :slight_smile:

I just try to use different arguments:

  1. Why it seemed to work for you

I think it worked for you when you wrote the tutorial, but when you tested it I guess you still had the “UILaunchImages” in your build.settings - you only removed this one day later after some comments to the tutorial.

And because of the “UILaunchImages” where you referenced “Splash.png”, “Splash@2x.png” and “Splash@3x.png” these images were shown on your devices. But the information to display these splash screens were NOT taken from the .nib file, because in there no reference to these files is set.

  1. Developer feedback

I’m not the only one in this threat encountering this, look at the postings from newbieLUA, Studycat, hgbrian…

  1. Cold logic

Assumptions:

* You want to use “Splash.png”, “Splash@2x.png” and “Splash@3x.png” as your splash screens

* You do NOT set “UILaunchImages” in your build.settings - so there is NO reference in build.settings to these files in your project

* The only things you’ll finally copy into your app project folder are the mentioned splash screens and the LaunchScreen.nib file

So, cold logic dictates that in the LaunchScreen.nib file there HAS to be a reference to the splash screens “Splash.png” etc. inside, otherwise iOS 8 can not know that these images should be used. Agreed? 

The LaunchScreen.nib file is compiled using ibtool --compile LaunchScreen.nib LaunchScreen.xib - this will do nothing else but take the LaunchScreen.xib file and convert it to a file that can be loaded at runtime, NOTHING IS ADDED, only the format is changed.

Deduction:

If you need to have a reference to the splash screens “Splash.png” etc. this reference HAS to be in the LaunchScreen.xib file.

Now have a look at the tutorial and create a LaunchScreen.xib file just as it is described there, and concentrate especially on these steps:

  1. Create three images which will be centered on the screen of various devices. You’ll need a 1×, 2×, and 3× version — these images don’t need to match specific sizes, but they will be shrunk or stretched to fit the  UIImageView  while maintaining the original aspect ratio.
  2. In the central pane, look for the  AppIcon  entry, right-click it, and choose  New Image Set.
  3. From the Finder, drag the file for your 1× splash image to the   slot, your 2× splash image file to the   slot and your 3× splash image file to the   slot.

By doing this you create a new image set called “Image” and use it in the following steps.

Now look at the LaunchScreen.xib file that is created at the end, e.g. open it in “Sublime 2”:

_There are only two references to the “Image” image set inside, but there is absolutely NO reference to the “Splash” images in the XML. _Interface Builder did not care to write the names of the files “Splash.png”, “Splash@2x.png” and “Splash@3x.png” you dragged into the project into the LaunchScreen.xib file.

So in the end you do NOT have a reference to your splash screen files in the LaunchScreen.xib file, and in the compiled LaunchScreen.nib file therefore there won’t be a reference inside, too, and the result is that iOS 8 will not know that the splash images based on “Splash.png” should be displayed.

But the solution is easy as I pointed out a two postings above:

Just rename the image set “Image” in IB to “Splash” and the use “Splash” in step 10 of the tutorial.

After this you have the reference “Splash” in the LaunchScreen.xib file and everything will work, the files “Splash.png”, “Splash@2x.png” and “Splash@3x.png” will be displayed on launch.

I hope this gives a clearer picture,

best,

Andreas

I’ll try and reproduce this tomorrow.  I know for certain that I did not have a UILaunchImages in the build.settings.   The images are in the images.xcassets folder in another JSON like file.  Since the images.xcassets file is known about by Xcode, I’m thinking it somehow gets into the nib file when it’s compiled.

I don’t have time today to dig back into this but hopefully I can work on this again tomorrow and try and figure out why you and the others are seeing something different than I am.

Rob

Hi Rob,

I tried to decompile the .nib file at look at the entries, but the “NibUnlocker.app” was not able to open the .nib. That’s a pity, this would have shed some light on the issue.

But I found that the .nib file is compiled from the .xib file regardless of its place in the folder or project hierarchy, and there is no reference in the .xib file to the xcode project the .xib belongs to. So I think it is not possible for the “ibtool” to find the images placed in the “Images.xcassets” folder, and that the “ibtool” does not follow any (if there would be any) references to other project files to then e.g. get paths to images.

Thanks for looking into it,

best,

Andreas

Question… if instead of using the Universal images in the ImageSet, I create separate images for the iPhone, Retina 4, and iPad and remove the Universal images, will it still activate the “Optimized for iPhone 6 / iPhone 6 Plus” setting in the App Store?

I did another test tonight and I think I see the problem.  I created my images and named them BooBoo.png, BooBoo@2x.png, and BooBoo@3x.png… obviously not names one would normally use.   When I created the image set in Xcode, I left it named “Image”, which is it’s default.  I built the Hello World app so that it was something that never had any of this in it.  I updated the build.settings and ran it.

No Images.

I renamed each image from BooBoo*.png to Image*.png and rebuilt the app.  I got images.   So whatever you name your images, you must also name your image set to and this will work.  I’ll add that step.

Rob

The tutorial is updated. 

Rob

i’ve spent hours on this without success. I can’t imagine what I’m doing wrong, the tutorial is very simple. I just get a black screen on Xcode simulator. Does anyone have a vertical nib with image only that I can try?

Maybe there is something wrong with my ibtool, I get this message frequently “Interface Builder could not open the document LaunchScreen.xib” because it does not exist." despite being in the same directory. Then I use sudo and it will work, change permissions on the nib etc but still no dice.

OK tried on iPhone 5 device for the first time and it works but not filling out the screen. Still black screen on iPhone 6+ in Xcode simulator. I guess I need to experiment more… 

Hi Jon,

please find my IB project attached, it uses portrait and the whole screen is filled, due to the constraints.

I guess you can just take the .nib file from the 

/_launchimage-freezeV2/LaunchImage/Base.lproj/

folder and copy it and the three “Default…png” files from

/_launchimage-freezeV2/LaunchImage/Images.xcassets/Default.imageset/

into your project folder. 

Just change the “Default…png” images and you should be good to go, worked for me on the iPad Air and the iPhone 6. 

But don’t forget: Like I told you a few posts above I use the “zoomEven” setting in my config.lua, and I scale the splash screens in my IB project the same way.

Good luck,

Andreas

Thank you very much Andreas. It’s late now so I’ll give it a go tomorrow.

I’ve been getting the error from ibtool saying it can’t find the .xib file.  I googled the error and it suggested that I kill a daemon that ibtool starts up from the command line:

killall ibtoold

When you run the ibtool command again, it will spew some errors:

robs-MBP:Base.lproj rmiracle$ ps auxww | grep ibtool
rmiracle         2611   0.0  0.0  2443012    676 s000  S+    7:50PM   0:00.00 grep ibtool
rmiracle         2605   0.0  0.4  3656444  60492   ??  Ss    7:49PM   0:01.77 /Applications/Xcode.app/Contents/Developer/usr/bin/ibtoold --sending-client-environment
robs-MBP:Base.lproj rmiracle$ killall ibtoold
robs-MBP:Base.lproj rmiracle$ ps auxww | grep ibtool
rmiracle         2615   0.0  0.0  2432772    648 s000  S+    7:50PM   0:00.00 grep ibtool
robs-MBP:Base.lproj rmiracle$ ibtool --compile LaunchScreen.nib LaunchScreen.xib
Oct 29 19:50:31 robs-MBP.attlocal.net ibtoold[2616] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Oct 29 19:50:31 robs-MBP.attlocal.net ibtoold[2616] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Oct 29 19:50:31 robs-MBP.attlocal.net ibtoold[2616] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
Oct 29 19:50:31 robs-MBP.attlocal.net ibtoold[2616] <Warning>: Invalid Connection ID 0
robs-MBP:Base.lproj rmiracle$ ibtool --compile LaunchScreen.nib LaunchScreen.xib

robs-MBP:Base.lproj rmiracle$

But run it again and it seems to work.

Rob

Found that one too Rob but didn’t try to run the second time :slight_smile: Nice find.

I guess my other non ibtool problems come from the fact that the iPhone 6+ Xcode simulator does not display the launch image ever? Is it like that for you guys?

Andreas nib file worked by dropping it into my project with my own images on all simulators except the iPhone 6 plus which as a black screen.

Edit: I updated to Xcode 6.1 and things seem to be fine in the iPhone 6 plus simulator now. Maybe recommend 6.1 in the tutorial, I’m guessing 6.01 has issue with 6+ sim. I had to use command line to open the correct sim with 6.1 though. 

Hi Jon,

a few days ago I sent in my iPhone 6 and ordered an iPhone 6 Plus, it is much more important for testing and e.g. for making app previews (that we will then scale down for iPhone 5/6).

I hope that beginning next week I have the iPhone 6 Plus and can test this on the device. Because I’m still curios if on the 6 Plus I will have a problem with the orientation switching to landscape or not (I don’t want this, I only support portrait, but the 6 Plus handles this a little bit differently, the device being unsure of being a tablet or a phone…).

Best,

Andreas

One more problem with @2x, @3x, @4x:

When I test the .nib on the iPad Air in portrait format (1536x2048 pixel) the splash screen “Default@2x.png” is shown - for testing I wrote some text like “1x”, “2x”, … into all my splash screens (that are connected to the .nib file), showing the different resolutions.

So, the system works, the .nib is accepted by the device, the splash screen is displayed.

BUT:

The iPad Air has 1536x2048 pixels, and these are my splash screens:

“Default.png” - 320x480

“Default@2x.png” - 640x960

“Default@3x.png” - 960x1440

“Default@4x.png” - 1280x1920

Why is the “Default@2x.png” with 640x960 pixel shown, and not this one: “Default@4x.png” - with 1280x1920 pixel?

It should not matter what is stated in the config.lua, but as somebody is bound to ask anyhow, here it is:

width = 320,

height = 480,

scale = “zoomEven”,

imageSuffix =

{

   ["@2x"] = 1.5,

   ["@3x"] = 2.5,

   ["@4x"] = 3.5,

},

@Jon:

Can you test this, too? I don’t have my iPhone 6 anymore (waiting for the 6 Plus), and it would be good to know what happens on these devices.

Best,

Andreas

@Andreas: Sorry I don’t have iPhone 6, I have just been testing in the simulator and hoping for the best.

Hey @Andreas,

Give this a try :

For iPad, name your image as “Default@2x~ipad.png” , and then for iPhones, name them as:

Default-568h@2x~iphone.png

Default-667h@2x~iphone.png

Default-736h@3x~iphone.png

and to be safe, keep another copy named:

Default@2x~iphone.png

There is no “@4x” in Apple’s iOS standard, only @2x and @3x. iPad Retina will still be considered @2x therefore, it will only pull Default@2x as the launch image. To differentiate them between iPhone & iPad, you can add the ~iwhatever attribute at the end of your filename and iOS will pick them out automagically.

Hope this helps!