Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

solinari6

macrumors regular
Original poster
Aug 13, 2008
101
16
So I've been developing my app, targetting ios8 (mainly because I just didn't have the ios7 emulator downloaded).

Anyway, my app was looking perfect across iphone 4,5,6, and 6+ while running on ios8.

So I decided to download the ios7 emulator and try that out. What I've found is very strange. When running on the iphone5/s and the ios7 emulator, there are black bars across the top and bottom of the screen. It looks like it is running all the iphone4 code instead of the iphone5.

I can't figure out what could be causing this. I don't have a real iphone 5 running ios7 to test it out on, so I can't tell if it's just an emulator fluke.

Any ideas? I just stepped through the code, and this:

CGRectGetHeight(UIScreen.mainScreen().bounds)

is returning 480 for both the iphone 4 and iphone 5, whereas when I run it in ios8, the iphone 5 returns 568.
 
Last edited:
Hmm, i'm not sure what you are pointing at there, but the issue isn't just the launch image, it's the entire app is the wrong size.

In iOS 6 and 7, the launch image determines the app's size. You won't see (or be able to color fill) a size other than 480 without the right launch image(s).
 
Basically, what they are trying to point you towards is that in iOS 6/7, the fact that you have a launch image sized to the iPhone 5 screen size is what tells iOS that your app is setup to run natively on the iPhone 5 screen size. Just include a launch image for this size, and it will run fine in iOS 6/7 on the iPhone 5 screen size
 
Ah, ok, got it. I'll double check my launch images, thanks!
 
Last edited:
Ok, so I checked the images, and this is what I have (these were generated by a launch image generator program, so I'm assuming they are right):

Default.png: 320x480
Default@2x.png: 640x960
Default-586h@2x: 640x1136

Ooop ... just found this error:
Applications using Launch Screen Files and targetting iOS 7.1 and earlier need to also include a Launch Image in an Asset Catalog.

So it looks like I needed to create the asset file with those launch images as well. Once I did that it started working correctly. Thanks guys!
 
Last edited:
That Default-586 file is the one that tells iOS that your app is written to work on iPhone 5. It used to be added to new projects when creating new projects from templates. I don't know if this file is still added automatically.

Many questions have been asked dozens, or even thousands of times. Everyone, even newbies, use google to find the answers to how to do something or why doesn't something work. Newbies may not know the right search terms. Posting a google search that has the answer in it seems like a useful thing to me. Writing out your question in words often finds the right answer. So if I google this:

why doesn't my iOS app have the right screen size on iPhone 5

The correct answer is in the top twenty results more than once. However, the google search I posted in my earlier response has the right answer in just about every one of top twenty results.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.