Deprecated Errors when running Corona Simulator

Anyone get this type of error:

WARNING: ui.lua:159: o:setTextColor() is deprecated. Use o:setFillColor() instead

 

I got 92 of these errors when trying to test my app in the simulator. Basically, the normal background image 1024x768 only displays a small amount (maybe 15%) in the upper left hand corner of the iPad screen. Any ideas on what is causing this and how to fix the code? Is it in the ui.lua file? Appreciate any help on this issue. Thanks!

 

John  :slight_smile:

The error tells you exactly what the error is and how to correct it.

Once upon a time, text display objects used setTextColor. They now mirror the other display objects and use setFillColor.

If you look at ui.lua, line 159, you’ll find a use of setTextColor. Simply change it. Better still, do a find/replace on every file in your project, since you seem to have a lot of them!

The background position will almost certainly be related to anchor points. It sounds like you’re specifying the x and y as 0,0 or display.screenOriginX/Y. In which case, make sure that your anchor points for the background object are set to 0.

https://docs.coronalabs.com/guide/graphics/transform-anchor.html

Note, these replace the old style setReferencePoints using strings like ‘topLeft’ - and judging by the issues you’re having with deprecated code, you might want to search your code for instances of setReferencePoint which will also give you deprecated warnings, as well as make things display strangely (rather, by NOT having specified anchor points) 

Edit: Oh, also, RGB colours range from 0 to 1 now. So if your old code is using values to 255, you’ll want to change those too, or you wont get the right colours! 

Just to clarify what’s going on.

Several years ago we made a major update to our graphics engine. We called it Graphics 2.0 and it consisted of quite a few breaking changes. You may find older tutorials/templates out there from the pre-2013 days that want to do things the old way. You may have your own apps that have the same behavior. I believe that we still support a key in the config.lua content table:

graphicsCompatibility = 1,

in the same spot where you specify width, height, etc. that will cause Corona to honor the old ways of doing things. However, that’s deprecated and at this point, three years after the updates, apps really need to be updated to the new way of doing things.

The core changes:  All objects by default are drawn based on their X, Y being at the center of the object. Previously somethings were drawn assuming a left-top X, Y. 

:setReferencePoint is replaced by .anchorX and .anchorY values.

Colors are in a 0…1 range instead of 0…255

:setTextColor is now :setFillColor like all other objects.

Rob

JWiow & Rob: Thanks for the posts! Got it fixed and my app is running fine now. Now I’ll go back and update all my older apps as well.

You guys are so helpful and responsive…All the Best! John :slight_smile:

The error tells you exactly what the error is and how to correct it.

Once upon a time, text display objects used setTextColor. They now mirror the other display objects and use setFillColor.

If you look at ui.lua, line 159, you’ll find a use of setTextColor. Simply change it. Better still, do a find/replace on every file in your project, since you seem to have a lot of them!

The background position will almost certainly be related to anchor points. It sounds like you’re specifying the x and y as 0,0 or display.screenOriginX/Y. In which case, make sure that your anchor points for the background object are set to 0.

https://docs.coronalabs.com/guide/graphics/transform-anchor.html

Note, these replace the old style setReferencePoints using strings like ‘topLeft’ - and judging by the issues you’re having with deprecated code, you might want to search your code for instances of setReferencePoint which will also give you deprecated warnings, as well as make things display strangely (rather, by NOT having specified anchor points) 

Edit: Oh, also, RGB colours range from 0 to 1 now. So if your old code is using values to 255, you’ll want to change those too, or you wont get the right colours! 

Just to clarify what’s going on.

Several years ago we made a major update to our graphics engine. We called it Graphics 2.0 and it consisted of quite a few breaking changes. You may find older tutorials/templates out there from the pre-2013 days that want to do things the old way. You may have your own apps that have the same behavior. I believe that we still support a key in the config.lua content table:

graphicsCompatibility = 1,

in the same spot where you specify width, height, etc. that will cause Corona to honor the old ways of doing things. However, that’s deprecated and at this point, three years after the updates, apps really need to be updated to the new way of doing things.

The core changes:  All objects by default are drawn based on their X, Y being at the center of the object. Previously somethings were drawn assuming a left-top X, Y. 

:setReferencePoint is replaced by .anchorX and .anchorY values.

Colors are in a 0…1 range instead of 0…255

:setTextColor is now :setFillColor like all other objects.

Rob

JWiow & Rob: Thanks for the posts! Got it fixed and my app is running fine now. Now I’ll go back and update all my older apps as well.

You guys are so helpful and responsive…All the Best! John :slight_smile:

02:25:37.858  

02:25:37.858  Windows simulator build date: Mar 31 2017 @ 14:34:46

02:25:37.858  

02:25:38.762  

02:25:38.762  Copyright © 2009-2017  C o r o n a   L a b s   I n c .

02:25:38.762   Version: 3.0.0

02:25:38.762   Build: 2017.3068

02:25:38.829  Platform: GT-I9300 / x64 / 6.3 / GeForce GT 730/PCIe/SSE2 / 4.5.0 NVIDIA 381.65 / 2017.3068 / en_US | US | en_US | en

02:25:38.829  WARNING: V1 graphics compatibility is deprecated. Some features may not work as expected

02:25:38.829  Loading project from:   C:\Users\User\DOCUME~1\Outlaw\Sandbox\4

02:25:38.829  Project sandbox folder: C:\Users\User\AppData\Local\Corona Labs\Corona Simulator\Sandbox\4-04B7CBC654E30C26D2907EE07538D119\Documents

02:25:38.829  WARNING: issue found in C:\Users\User\DOCUME~1\Outlaw\Sandbox\4\build.settings: 

02:25:38.829  WARNING: deprecated key: settings.iphone.plist.CFBundleIconFile (string)

02:25:38.829  WARNING: deprecated key: settings.androidPermissions[] (string)

02:25:38.829  WARNING: issue found in C:\Users\User\DOCUME~1\Outlaw\Sandbox\4\config.lua: 

02:25:38.829  WARNING: unrecognized key: settings.content.yalign (string) (incorrect capitalization)

02:25:38.829  WARNING: unrecognized key: settings.content.xalign (string) (incorrect capitalization)

We now look more carefully at your build.settings. These warning are very useful.

  1. CFBundleIconFile was an iOS 5 feature. You no longer need this in your build.settings

  2. Android permissions should be inside the “android” table (settings.android.usePermissions). What you have will be ignored.

    android = { usesPermissions = { “com.android.vending.BILLING”, “com.android.vending.CHECK_LICENSE”, “android.permission.INTERNET”, “android.permission.WRITE_EXTERNAL_STORAGE”, “android.permission.ACCESS_NETWORK_STATE”, }, },

for instance.

Then in your config.lua you have xalign and yalign, these need to be xAlign and yAlign. These values are case sensitive.

Rob

thank you so much rob :slight_smile:

02:25:37.858  

02:25:37.858  Windows simulator build date: Mar 31 2017 @ 14:34:46

02:25:37.858  

02:25:38.762  

02:25:38.762  Copyright © 2009-2017  C o r o n a   L a b s   I n c .

02:25:38.762   Version: 3.0.0

02:25:38.762   Build: 2017.3068

02:25:38.829  Platform: GT-I9300 / x64 / 6.3 / GeForce GT 730/PCIe/SSE2 / 4.5.0 NVIDIA 381.65 / 2017.3068 / en_US | US | en_US | en

02:25:38.829  WARNING: V1 graphics compatibility is deprecated. Some features may not work as expected

02:25:38.829  Loading project from:   C:\Users\User\DOCUME~1\Outlaw\Sandbox\4

02:25:38.829  Project sandbox folder: C:\Users\User\AppData\Local\Corona Labs\Corona Simulator\Sandbox\4-04B7CBC654E30C26D2907EE07538D119\Documents

02:25:38.829  WARNING: issue found in C:\Users\User\DOCUME~1\Outlaw\Sandbox\4\build.settings: 

02:25:38.829  WARNING: deprecated key: settings.iphone.plist.CFBundleIconFile (string)

02:25:38.829  WARNING: deprecated key: settings.androidPermissions[] (string)

02:25:38.829  WARNING: issue found in C:\Users\User\DOCUME~1\Outlaw\Sandbox\4\config.lua: 

02:25:38.829  WARNING: unrecognized key: settings.content.yalign (string) (incorrect capitalization)

02:25:38.829  WARNING: unrecognized key: settings.content.xalign (string) (incorrect capitalization)

We now look more carefully at your build.settings. These warning are very useful.

  1. CFBundleIconFile was an iOS 5 feature. You no longer need this in your build.settings

  2. Android permissions should be inside the “android” table (settings.android.usePermissions). What you have will be ignored.

    android = { usesPermissions = { “com.android.vending.BILLING”, “com.android.vending.CHECK_LICENSE”, “android.permission.INTERNET”, “android.permission.WRITE_EXTERNAL_STORAGE”, “android.permission.ACCESS_NETWORK_STATE”, }, },

for instance.

Then in your config.lua you have xalign and yalign, these need to be xAlign and yAlign. These values are case sensitive.

Rob

thank you so much rob :slight_smile: