Dimensions Different in Simulator?

The dimensions of the device are appearing differently in the simulator vs after build.

For example, the dimensions of the iPhone 6 in the simulator are:

display.pixelWidth = 750

display.pixelHeight = 1334

(aspect ratio = 1.778)

However, when I build the app in xCode for the same device (iPhone 6) the dimensions appear:

display.pixelWidth = 640

display.pixelHeight = 960

This leads to an aspect ratio of 1.5 and is causing significant problems in the placement of objects.

Does anyone know why this is happening and how I can fix it?

Thanks in advance!

KC

Are you sure you are using iPhone 6 as those are the dimensions of an iPhone 4s?

What canvas size have you specified in your config.lua?

When you build for device you have to follow Apple’s rules that determine the screen size.

In the absence of a launch image setup and missing a Default-568h@2x.png file or a LaunchScreen.storyboardc file (and included correctly in build.settings) you will get a screen size of 640x960 regardless of the device. If you include the Default-568h@2x.png, you will get 640x1136 on iPhone 5 and later.  Then on the iPhone 6/6s/7 you have to include a Default-667h@2x.png file if you want to get the 750x1334 size. If you want to get the full screen on an iPhone 6 plus/6s plus/7 plus then you have to include a Default-736h@3x.png file.

If you choose to use these Default*.png images, you have to include a really big table in build.settings to go with it. Apple wants you to use the LaunchScreen.storyboardc file instead of these default images.  See:
 

https://docs.coronalabs.com/guide/distribution/buildSettings/index.html#ios-launch-screen

Rob

Are you testing on a device or in a simulated device on your Mac?  Like Rob said, that sounds an awful lot like the iPhone 4s

Hello,

just a line to propose to promote this post to somewhere more visible - it costed me a few days to have my app using the full iPhone screen, until I found this post.

Now I’ve spent a good while searching for it, again… no easy, and many posts on this issue not addressing the need for those files Rob wrote here.

So please highlight this or include this information in the “config.lua” pages on the web… one can waste time choosing different scale methods, pixel resolutions… and still miss this.

Thanks,

jaime

Are you sure you are using iPhone 6 as those are the dimensions of an iPhone 4s?

What canvas size have you specified in your config.lua?

When you build for device you have to follow Apple’s rules that determine the screen size.

In the absence of a launch image setup and missing a Default-568h@2x.png file or a LaunchScreen.storyboardc file (and included correctly in build.settings) you will get a screen size of 640x960 regardless of the device. If you include the Default-568h@2x.png, you will get 640x1136 on iPhone 5 and later.  Then on the iPhone 6/6s/7 you have to include a Default-667h@2x.png file if you want to get the 750x1334 size. If you want to get the full screen on an iPhone 6 plus/6s plus/7 plus then you have to include a Default-736h@3x.png file.

If you choose to use these Default*.png images, you have to include a really big table in build.settings to go with it. Apple wants you to use the LaunchScreen.storyboardc file instead of these default images.  See:
 

https://docs.coronalabs.com/guide/distribution/buildSettings/index.html#ios-launch-screen

Rob

Are you testing on a device or in a simulated device on your Mac?  Like Rob said, that sounds an awful lot like the iPhone 4s

Hello,

just a line to propose to promote this post to somewhere more visible - it costed me a few days to have my app using the full iPhone screen, until I found this post.

Now I’ve spent a good while searching for it, again… no easy, and many posts on this issue not addressing the need for those files Rob wrote here.

So please highlight this or include this information in the “config.lua” pages on the web… one can waste time choosing different scale methods, pixel resolutions… and still miss this.

Thanks,

jaime