Black space on Iphone 5s

Hi guys so I’m having a hard time trying to figured this out. When i test my app in the emulator it looks great but when i deploy it to the device(iphone 5s) i get black space on the left and right side of the device. This is how my build.setting file looks like.

-- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight settings = { plugins = { -- key is the name passed to Lua's 'require()' ["CoronaProvider.ads.iads"] = { -- required publisherId = "com.coronalabs", }, }, orientation = { default = "landscapeLeft", supported = { "landscapeLeft", } }, iphone = { plist = { UIStatusBarHidden = false, UIPrerenderedIcon = true, -- set to false for "shine" overlay UIApplicationExitsOnSuspend = true, -- uncomment to quit app on suspend --[[-- iOS app URL schemes: CFBundleURLTypes = { { CFBundleURLSchemes = { "fbXXXXXXXXXXXXXX", -- example scheme for facebook "coronasdkapp", -- example second scheme } } } --]] } }, }

and this is my config.lua

if string.sub(system.getInfo("model"),1,4) == "iPad" then application = { content = { width = 360, height = 480, scale = "letterBox", xAlign = "center", yAlign = "center", imageSuffix = { ["@2x"] = 1.5, ["@4x"] = 3.0, }, }, notification = { iphone = { types = { "badge", "sound", "alert" } } } } elseif string.sub(system.getInfo("model"),1,2) == "iP" and display.pixelHeight \> 960 then application = { content = { width = 320, height = 568, scale = "letterBox", xAlign = "center", yAlign = "center", imageSuffix = { ["@2x"] = 1.5, ["@4x"] = 3.0, }, }, notification = { iphone = { types = { "badge", "sound", "alert" } } } } elseif string.sub(system.getInfo("model"),1,2) == "iP" then application = { content = { width = 320, height = 480, scale = "letterBox", xAlign = "center", yAlign = "center", imageSuffix = { ["@2x"] = 1.5, ["@4x"] = 3.0, }, }, notification = { iphone = { types = { "badge", "sound", "alert" } } } } elseif display.pixelHeight / display.pixelWidth \> 1.72 then application = { content = { width = 320, height = 570, scale = "letterBox", xAlign = "center", yAlign = "center", imageSuffix = { ["@2x"] = 1.5, ["@4x"] = 3.0, }, }, } else application = { content = { width = 320, height = 512, scale = "letterBox", xAlign = "center", yAlign = "center", imageSuffix = { ["@2x"] = 1.5, ["@4x"] = 3.0, }, }, notification = { iphone = { types = { "badge", "sound", "alert" } } } } end

I have also included the default image Default-568h@2x.png but it still doesn’t work on my device. Please help me with this! Thanks!

Anyone?

Can you print out the values for display.contentHeight and display.contentWidth?  That way we can figure out exactly which configuration is being used.

Also, can you post the code where you’re loading  your backgrounds?  What size are they?

Hi Rob,

I printed the values in the emulator and this is what i got

for display.contentWidth - 568

for display.contentHeight - 320

in the device (using the xcode organizer console) i got 

for display.contentWidth - 480

for display.contentHeight - 320 

this is the code for my background image

    background = display.newImageRect(“images/background_menu.png”, display.contentWidth, display.contentHeight)

    background.anchorX = 0

    background.anchorY = 0

    background.x = 0

    background.y = 0

my background image is 

1136 × 640

My app runs on landscape mode.

Do you have the required file:  Default-568h@2x.png  (a 640x1136 PNG file) in the folder with your main.lua?

Yes I have that image in the same folder with the main.lua

Do you have the exact file name (It’s case sensitive on the device)?  The file has to be exactly 640 wide and 1136 high.  If you have it 1136 w and 640 high, it could cause problems.

Yes i do. I have look at that file over 100 times by now to make sure it’s correct and it is lol

Then the only logical other issue would be either an error in your config.lua or the device thinks it’s display.pixelHeight is 960 or less.  The only real reason for this 2nd option is if iOS doesn’t like that Default-568h@2x.png file.

Rob

Hi Rob I fixed it now. I think IOS didn’t like the file. I created a brand new Default-568h@2x.png and for some reason that fixed the problem. Thanks s lot for the help. :slight_smile:

There is a place where you can copy the file name that has an ndash character instead of a hyphen.  It burns people frequently.

Anyone?

Can you print out the values for display.contentHeight and display.contentWidth?  That way we can figure out exactly which configuration is being used.

Also, can you post the code where you’re loading  your backgrounds?  What size are they?

Hi Rob,

I printed the values in the emulator and this is what i got

for display.contentWidth - 568

for display.contentHeight - 320

in the device (using the xcode organizer console) i got 

for display.contentWidth - 480

for display.contentHeight - 320 

this is the code for my background image

    background = display.newImageRect(“images/background_menu.png”, display.contentWidth, display.contentHeight)

    background.anchorX = 0

    background.anchorY = 0

    background.x = 0

    background.y = 0

my background image is 

1136 × 640

My app runs on landscape mode.

Do you have the required file:  Default-568h@2x.png  (a 640x1136 PNG file) in the folder with your main.lua?

Yes I have that image in the same folder with the main.lua

Do you have the exact file name (It’s case sensitive on the device)?  The file has to be exactly 640 wide and 1136 high.  If you have it 1136 w and 640 high, it could cause problems.

Yes i do. I have look at that file over 100 times by now to make sure it’s correct and it is lol

Then the only logical other issue would be either an error in your config.lua or the device thinks it’s display.pixelHeight is 960 or less.  The only real reason for this 2nd option is if iOS doesn’t like that Default-568h@2x.png file.

Rob

Hi Rob I fixed it now. I think IOS didn’t like the file. I created a brand new Default-568h@2x.png and for some reason that fixed the problem. Thanks s lot for the help. :slight_smile: