iPhone6

Hello all, is anyone getting this type of error when trying to simply display a background for iPhone6

<Notice>: flow_divert_token_set (0): Failed to get the key unit from the token: 22

 <Error>: Could not set socket option SO_OPPORTUNISTIC: Invalid argument

Does anyone know what this is?

Regards

JZ 

This does not look like something coming from Corona SDK.  I would think it’s not something you have to worry about with regards to your app.  Is there more to the message?

Rob

Hi Rob, thanks for getting back. 

The errors are showing up in the iOS Window Devices log. 

Also , i am getting a Runtime error , the program crashes on this

sceneGroup:insert(SplashImage) 

For the life of me I cannot figure it out.   maybe my config.lua for iPhone6 is not good. I went searching and looked at some arguments 

about ultimate config.lua files. is there an updated one for the iPhone6 and plus. ? 

JZ 

How about posting the whole error you’re seeing?  If you  have a Runtime error, there should be a stack trace that has more information.

You can post your config.lua too, but it should work on the iPhone 6, though there might be a better way.

Rob

  1. Okay been at this for most of the day. So here it is , for some reason the isIphone6 == true was not being triggered, i reSet my config.lua file and it is working better. 

But If you Know of a better way to set up the config.lua file , a look at it will be much appreciated. 

Regards

Jz 

Thanks for your help Rob. 

It didn’t post.

Most people today are using the more modern and simpler approach listed here: 

http://coronalabs.com/blog/2013/09/10/modernizing-the-config-lua/

This version doesn’t  do device checking.  It take the device’s reported pixels to calculate the content area. 

Rob

Hello Rob, Great I understand what is happening in the tutorial, however I am still a bit confused about the asset sizes. 

After testing and resizing my images they are now bigger than the actually screen. 

Am I sizing these the correct way, my target is iPhone4, 5, 6, 6+ 

i.e. icon.png is 640 x 960

i.e icon@2x.png is 1240 x 1920 

Regards 

JZ 

Can you post the config.lua you are using?

Rob

Here,

application = {

         content = {

            width = aspectRatio > 1.5 and 800 or math.ceil( 1200 / aspectRatio ),

            height = aspectRatio < 1.5 and 1200 or math.ceil(800 * aspectRatio ),

            scale = “letterBox”,

             xAlign = “center”,

             yAlign = “center”,

            fps = 30,

                      imageSuffix = {

                         ["@2x"] = 1.3,

                   },

               },

          }

Thanks

JZ 

Just to make sure, you config.lua has these two lines at the very top:

–calculate the aspect ratio of the device:
local aspectRatio = display.pixelHeight / display.pixelWidth

The second line is critical to the functioning of the config.lua.

Assuming it’s there, what’s going to happen here is that on the iPhone 6, you will have a virtual screen that is 800 content units (points) wide and 1423 points high.  For all phones, you will get the 800 width and the content height will get calculated for you.  For iPads, you will get a 1200 point high screen and the width gets calculated (which will be 900 points).

To use the @2x images, you have to be using display.newImageRect() not display.newImage().  Corona SDK will look at the real screen and compute a scale factor based on your content area.  In this case, the device is a physical 750px and you’re using 800 points.  750/800 is 0.9375.  That is less than < the 1.3 you defined in your content area, so given:

icon.png   and icon@2x.png

display.newImageRect() will use icon.png.  On an iPhone 6 Plus, being a 1080 pixel device,  you have a scale factor of 1.35.  It will use your @2x version of the image.  If icon.png is 640x960, icon@2x.png should be 1280x1920.

Now for display.newImageRect() you have to pass the width and height.  So if you call:

local icon = display.newImageRect(“icon.png”, 640, 960)

It will load the image as a 640x960 image and be put on an 800x1423 screen (iPhone 6) which is going to be smaller than the screen.    If you tell display.newImageRect() to use 800, 1200, then it will fill the screen width wise and Corona will have to enlarge it a bit.   On the iPhone 6 plus, it will use the larger image and shrink it up or down to make it fit the relative screen.

Rob

Generally you plan your images to be some proportion of the defined content area.

This does not look like something coming from Corona SDK.  I would think it’s not something you have to worry about with regards to your app.  Is there more to the message?

Rob

Hi Rob, thanks for getting back. 

The errors are showing up in the iOS Window Devices log. 

Also , i am getting a Runtime error , the program crashes on this

sceneGroup:insert(SplashImage) 

For the life of me I cannot figure it out.   maybe my config.lua for iPhone6 is not good. I went searching and looked at some arguments 

about ultimate config.lua files. is there an updated one for the iPhone6 and plus. ? 

JZ 

How about posting the whole error you’re seeing?  If you  have a Runtime error, there should be a stack trace that has more information.

You can post your config.lua too, but it should work on the iPhone 6, though there might be a better way.

Rob

  1. Okay been at this for most of the day. So here it is , for some reason the isIphone6 == true was not being triggered, i reSet my config.lua file and it is working better. 

But If you Know of a better way to set up the config.lua file , a look at it will be much appreciated. 

Regards

Jz 

Thanks for your help Rob. 

It didn’t post.

Most people today are using the more modern and simpler approach listed here: 

http://coronalabs.com/blog/2013/09/10/modernizing-the-config-lua/

This version doesn’t  do device checking.  It take the device’s reported pixels to calculate the content area. 

Rob

Hello Rob, Great I understand what is happening in the tutorial, however I am still a bit confused about the asset sizes. 

After testing and resizing my images they are now bigger than the actually screen. 

Am I sizing these the correct way, my target is iPhone4, 5, 6, 6+ 

i.e. icon.png is 640 x 960

i.e icon@2x.png is 1240 x 1920 

Regards 

JZ 

Can you post the config.lua you are using?

Rob

Here,

application = {

         content = {

            width = aspectRatio > 1.5 and 800 or math.ceil( 1200 / aspectRatio ),

            height = aspectRatio < 1.5 and 1200 or math.ceil(800 * aspectRatio ),

            scale = “letterBox”,

             xAlign = “center”,

             yAlign = “center”,

            fps = 30,

                      imageSuffix = {

                         ["@2x"] = 1.3,

                   },

               },

          }

Thanks

JZ 

Just to make sure, you config.lua has these two lines at the very top:

–calculate the aspect ratio of the device:
local aspectRatio = display.pixelHeight / display.pixelWidth

The second line is critical to the functioning of the config.lua.

Assuming it’s there, what’s going to happen here is that on the iPhone 6, you will have a virtual screen that is 800 content units (points) wide and 1423 points high.  For all phones, you will get the 800 width and the content height will get calculated for you.  For iPads, you will get a 1200 point high screen and the width gets calculated (which will be 900 points).

To use the @2x images, you have to be using display.newImageRect() not display.newImage().  Corona SDK will look at the real screen and compute a scale factor based on your content area.  In this case, the device is a physical 750px and you’re using 800 points.  750/800 is 0.9375.  That is less than < the 1.3 you defined in your content area, so given:

icon.png   and icon@2x.png

display.newImageRect() will use icon.png.  On an iPhone 6 Plus, being a 1080 pixel device,  you have a scale factor of 1.35.  It will use your @2x version of the image.  If icon.png is 640x960, icon@2x.png should be 1280x1920.

Now for display.newImageRect() you have to pass the width and height.  So if you call:

local icon = display.newImageRect(“icon.png”, 640, 960)

It will load the image as a 640x960 image and be put on an 800x1423 screen (iPhone 6) which is going to be smaller than the screen.    If you tell display.newImageRect() to use 800, 1200, then it will fill the screen width wise and Corona will have to enlarge it a bit.   On the iPhone 6 plus, it will use the larger image and shrink it up or down to make it fit the relative screen.

Rob

Generally you plan your images to be some proportion of the defined content area.