App Works fine in Corona Simulator, but not in Xcode simulator or device----any ideas?

Hi

I have a storyboard framework app that is running ‘as designed’ in corona simulator. When built for device or xcode simulator the app fails in at least a couple of places. The first scene is a table view with images and text.

The images show in the rows, but no text shows. I have loaded FONT tiff files and other font files and changed font to Helvetica, but still no text showing in rows, only images.

Second when the row is clicked it shows another scene also with a tableview with more rows when in corona simulator.

In xcode simulator or on the device,  the app fails (it does not show the next scene, but just a background image .

In have checked memory on corona . At First scene
MEMORY = 392.972 KB    TEXTURE = 1.1845703125

at second scene

MEMORY = 1068.695 KB    TEXTURE = 1.34423828125

Any clues here?

So, I am looking for helpful suggestions on the next -debug- stage, on the device and/or xcode simulator. All is working well in corona as I have already stated… :{

Thanks

Hi @cockle, first the #1 reason for “it works in the sim but not on device” is that the device is case sensitive with filenames, where our simulator is not.  I would suggest looking to make sure the case of your file names referenced in code (including storyboard scene names) matches what is really on the file system.

Next, with fonts, the Corona Simulator uses the fonts installed on your Mac.  It does not use fonts in the folder with your main.lua or specified in your build.settings file.  But it sounds like fonts work on your Mac but not in the Xcode simulator or on device.  That would point to a problem with your build.settings file.  Can you post it?

Your memory numbers are very tiny.  1mb of lua memory and 1.3mb of texture memory.  You should be able to easily handle 2 digit numbers in both of those (though 10+mb of Lua memory would be pretty bizzare!)  What likely is you have an error in the scene you are trying to go to just after the background image is loaded (that filename case sensitivity problem sounds very likely)

You can run the Console app on your Mac (found in /Applications or by clicking on the Spotlight search and typing in “Console”).  It will show you the print statements from Corona as well as any error messages that are being generated.  You can see the same thing on the device if you have it tethered to your USB port and use XCode’s Organizer, find your device and click on the “Console” link just under the device name.

Hi Rob,

Thanks for the succinct pointers to possible causes… and the Console access guide. I will give these a trial over the weekend.

It looks like I need to take more careful time to   step through these

First.

Fonts. I would liked to have sent you the build.settings file, but, when I looked I did not have one! A LOng story, but in brief Jay’s Outlaw code editor   ‘Publish button’, recently deleted all my source folders (it clears out folders and everything below-where my source was) so i have been rebuilding projects from an older backup and  somehow the build.settings got left behind…

I have now put a build setting file in the project which at is very simple (see below ), but still no text is showing on the TableView rows!  I am therefore  not clear on what actually has to be done to ensure the fonts file is included in the App Build for the device (e.g. what file types, ttf ?  Some of the font files have no type e.g. ‘Gloucester MT Extra Condensed’ the one I use) . I could use a default font but the size and layout would alter my design now.

Second

CASE Sensitivity A good piece of information, which I have been checking but as yet i have not found the cause of the scene failing. I am suspecting a network link (case?) or some problem related  to  downloading combined with your pointer, so  I will spend time using your suggested Console use. I have already checked scene names and the one file accessed.

a Third additional query has now popped in…

An Interesting  point (to me) re- build.settings & Config files.

When I did not have any Config or build settings, I had the app running in the corona simulator extremely well and my 'spread sheet’s scenes re-formatted perfectly on all apple hardware iphone thru ipads. I was really pleased.

When I now use the ‘build and config’ file settings I see double scaling across device types (too large fonts and images), so i have disabled my scaling code. Now the iPad and Iphone 5 ‘spreadsheets’ don’t quite fit the portrait width, with gaps each side. Is this because I now have a config file overriding/causing Corona to adjust scenes displays as it feels appropriate . Can I leave off the Config settings and use my own scaling? Do you foresee problems with this? Is it the height width or scale “letterbox” controlling this?

Thanks agian

Alec

BUILD

settings =
{
    orientation =
    {
        default =“portrait”,
        content = “portrait”,
        supported =
        {
            “portrait”
        },
    },

    iphone =
    {
        plist =
        {
            UIAppFonts = {“Gloucester MT Extra Condensed”}

        },
    },

}

CONFIG

application =
{
    content =
    {
        width = 320,
        height = 480,
        scale = “letterbox”,
        fps = 30,
        antialias = false,
        xAlign = “center”,
        yAlign = “center”
    }
}

Hi Rob,

The Second problem , called here Case Sensitivity is due to the Xcode simulator cannot find a ‘module’ holding general functions (ShowResultsinSheet).

The module (one of many) is in the right place and works with Corona. I have checked spellings and upper lower case and all looks good. Before I fall back and put all code in the  scene.lua (cant do this for all future scenes as they refer to same module functions)  have you any thoughts on the consule output…? see below!

The resource not available (asset) has all ‘local’ defined  functions and an internal table holding the references which is returned at the end of the module. Changing the functions to public has no effect on the problem.

I have many require statements, if I remove the problem one marked ** then the app runs further but naturally crashes later…

So Xcode simulator is finding the other requires modules, as shown. So ther is something wrong with just one as far as I can tell.

local Results = require “Results”
local GeneralUtilities = require “GeneralUtilities”
local ShowResultsinSheet =require “ShowResultsinSheet” **
local SpreadSheetRoutines =require “SpreadSheetRoutines”
 


01/06/2013 21:52:58.085 thecompanion[3243]: Runtime error
module ‘ShowResultsinSheet’ not found:resource (ShowResultsinSheet.lu) does not exist in archive
    no field package.preload[‘ShowResultsinSheet’]
    no file ‘/Users/aleccockleNewMacbook/Library/Application Support/iPhone Simulator/6.1/Applications/7DB641F7-CD2E-4A3D-AEEF-21C008061D70/thecompanion.app/ShowResultsinSheet.lua’
    no file ‘/Users/aleccockleNewMacbook/Library/Application Support/iPhone Simulator/6.1/Applications/7DB641F7-CD2E-4A3D-AEEF-21C008061D70/thecompanion.app/ShowResultsinSheet.lua’
    no file ‘./ShowResultsinSheet.so’
    no file '/Users/aleccockleNewMacbook/Library/Application Support/iPhone Simulator/6.1/Applications/7DB641F7-CD2E-4A3D-AEEF-21C008061D70/thecompanion.app/ShowResultsinSheet.so’ShowResultsinSheet
stack traceback:
    [C]: ?
    [C]: in function ‘error’
    ?: in function ‘gotoScene’
    …d Up Code/the  companion/Scenes/LogoIntro.lua:48: in function ‘_listener’
    ?: in function <?:141>
    ?: in function <?:218>
 

Rob,

Yes you were right Case Sensitivity as you said ‘ShowResultsinSheet’ instead of ‘ShowResultsInSheet’

Can you spot the difference?

I am now left with just the Font issue. i.e. How to I get xcode and the device to recognise the font I need and have included.

A couple of PSs.

Two questions

  1. Why don’t Apple use a ‘default’ font if requested font  not found?

  2. Why does Corona simulator allow either upper or lower case names while Apple does not? Creates a  large scope for error and time waste. Is this an easy ‘improvement’ for corona (or what is the benefit as is?

Sorry about the one way conversation here…

Ref Scaling across devices iphone and iPads -all types. My Own Scaling code worked without a config file. But did not work perfectly when using a config file. I have since found if I leave out ‘letter box’, all is fine and dandy! i.e works well and all scenes fit the display perfectly.

I guess this is only of interest to those new to this …

Finally I have decided to move on!!!  I have failed to get the font to show. I have instead now used a condensed system font. So now my App is ok on the Xcode simulator…

Ref discussion

http://www.coronalabs.com/blog/2011/07/13/custom-fonts-corona/

and notes and comments there-in

"

_ NOTE: Some fonts do not display for whatever reason.
Often, it’s how the font file was built (slightly corrupted—sometimes
you get these from free font sites), so if you just can’t get the font
to show up (be sure to test on device), then try another custom font to
rule out file corruption._

"

@cockle, sometimes talking to yourself helps solve your problems.  I’m glad you’ve worked everything out.  Yes, your case sensitivity problem was a lowercase i and an uppercase I.  It’s all it takes.

When you do not provide a config.lua, your app uses the device to scale.  That’s okay if you want to take responsibility to scale everything on your own.  Having a config.lua baselines all devices to a common coordinate/size system.  Corona deals with the scaling and if you are scaling and we are scaling, you get double.

As for the font, yea, not all of font files are good to use.

Hi Rob,

Talking yourself into thinking it was working is not all good (well at least it did function correctly in xcode simulator) but would you believe it , the app failed, yes failed on the device, after working in the xcode simulator!!!

These development tools take me back to ‘papertape’ debugging (1960’s) , where a small hole punch, not quite complete, sometimes was read and worked and  sometimes didn’t!

Anyway, the problem again was Case sensitivity on my image assets folder. The  name used was ‘image’ on the folder which worked in the simulator, but should have been ‘Image’ as in the code, which the device rejected.

But at last I have a working app section on the iPhone!!!

I must attend a better typing class, or get new glasses…

Thanks for your patience and experienced pointers.

Glasses helped me.

Hi @cockle, first the #1 reason for “it works in the sim but not on device” is that the device is case sensitive with filenames, where our simulator is not.  I would suggest looking to make sure the case of your file names referenced in code (including storyboard scene names) matches what is really on the file system.

Next, with fonts, the Corona Simulator uses the fonts installed on your Mac.  It does not use fonts in the folder with your main.lua or specified in your build.settings file.  But it sounds like fonts work on your Mac but not in the Xcode simulator or on device.  That would point to a problem with your build.settings file.  Can you post it?

Your memory numbers are very tiny.  1mb of lua memory and 1.3mb of texture memory.  You should be able to easily handle 2 digit numbers in both of those (though 10+mb of Lua memory would be pretty bizzare!)  What likely is you have an error in the scene you are trying to go to just after the background image is loaded (that filename case sensitivity problem sounds very likely)

You can run the Console app on your Mac (found in /Applications or by clicking on the Spotlight search and typing in “Console”).  It will show you the print statements from Corona as well as any error messages that are being generated.  You can see the same thing on the device if you have it tethered to your USB port and use XCode’s Organizer, find your device and click on the “Console” link just under the device name.

Hi Rob,

Thanks for the succinct pointers to possible causes… and the Console access guide. I will give these a trial over the weekend.

It looks like I need to take more careful time to   step through these

First.

Fonts. I would liked to have sent you the build.settings file, but, when I looked I did not have one! A LOng story, but in brief Jay’s Outlaw code editor   ‘Publish button’, recently deleted all my source folders (it clears out folders and everything below-where my source was) so i have been rebuilding projects from an older backup and  somehow the build.settings got left behind…

I have now put a build setting file in the project which at is very simple (see below ), but still no text is showing on the TableView rows!  I am therefore  not clear on what actually has to be done to ensure the fonts file is included in the App Build for the device (e.g. what file types, ttf ?  Some of the font files have no type e.g. ‘Gloucester MT Extra Condensed’ the one I use) . I could use a default font but the size and layout would alter my design now.

Second

CASE Sensitivity A good piece of information, which I have been checking but as yet i have not found the cause of the scene failing. I am suspecting a network link (case?) or some problem related  to  downloading combined with your pointer, so  I will spend time using your suggested Console use. I have already checked scene names and the one file accessed.

a Third additional query has now popped in…

An Interesting  point (to me) re- build.settings & Config files.

When I did not have any Config or build settings, I had the app running in the corona simulator extremely well and my 'spread sheet’s scenes re-formatted perfectly on all apple hardware iphone thru ipads. I was really pleased.

When I now use the ‘build and config’ file settings I see double scaling across device types (too large fonts and images), so i have disabled my scaling code. Now the iPad and Iphone 5 ‘spreadsheets’ don’t quite fit the portrait width, with gaps each side. Is this because I now have a config file overriding/causing Corona to adjust scenes displays as it feels appropriate . Can I leave off the Config settings and use my own scaling? Do you foresee problems with this? Is it the height width or scale “letterbox” controlling this?

Thanks agian

Alec

BUILD

settings =
{
    orientation =
    {
        default =“portrait”,
        content = “portrait”,
        supported =
        {
            “portrait”
        },
    },

    iphone =
    {
        plist =
        {
            UIAppFonts = {“Gloucester MT Extra Condensed”}

        },
    },

}

CONFIG

application =
{
    content =
    {
        width = 320,
        height = 480,
        scale = “letterbox”,
        fps = 30,
        antialias = false,
        xAlign = “center”,
        yAlign = “center”
    }
}

Hi Rob,

The Second problem , called here Case Sensitivity is due to the Xcode simulator cannot find a ‘module’ holding general functions (ShowResultsinSheet).

The module (one of many) is in the right place and works with Corona. I have checked spellings and upper lower case and all looks good. Before I fall back and put all code in the  scene.lua (cant do this for all future scenes as they refer to same module functions)  have you any thoughts on the consule output…? see below!

The resource not available (asset) has all ‘local’ defined  functions and an internal table holding the references which is returned at the end of the module. Changing the functions to public has no effect on the problem.

I have many require statements, if I remove the problem one marked ** then the app runs further but naturally crashes later…

So Xcode simulator is finding the other requires modules, as shown. So ther is something wrong with just one as far as I can tell.

local Results = require “Results”
local GeneralUtilities = require “GeneralUtilities”
local ShowResultsinSheet =require “ShowResultsinSheet” **
local SpreadSheetRoutines =require “SpreadSheetRoutines”
 


01/06/2013 21:52:58.085 thecompanion[3243]: Runtime error
module ‘ShowResultsinSheet’ not found:resource (ShowResultsinSheet.lu) does not exist in archive
    no field package.preload[‘ShowResultsinSheet’]
    no file ‘/Users/aleccockleNewMacbook/Library/Application Support/iPhone Simulator/6.1/Applications/7DB641F7-CD2E-4A3D-AEEF-21C008061D70/thecompanion.app/ShowResultsinSheet.lua’
    no file ‘/Users/aleccockleNewMacbook/Library/Application Support/iPhone Simulator/6.1/Applications/7DB641F7-CD2E-4A3D-AEEF-21C008061D70/thecompanion.app/ShowResultsinSheet.lua’
    no file ‘./ShowResultsinSheet.so’
    no file '/Users/aleccockleNewMacbook/Library/Application Support/iPhone Simulator/6.1/Applications/7DB641F7-CD2E-4A3D-AEEF-21C008061D70/thecompanion.app/ShowResultsinSheet.so’ShowResultsinSheet
stack traceback:
    [C]: ?
    [C]: in function ‘error’
    ?: in function ‘gotoScene’
    …d Up Code/the  companion/Scenes/LogoIntro.lua:48: in function ‘_listener’
    ?: in function <?:141>
    ?: in function <?:218>
 

Rob,

Yes you were right Case Sensitivity as you said ‘ShowResultsinSheet’ instead of ‘ShowResultsInSheet’

Can you spot the difference?

I am now left with just the Font issue. i.e. How to I get xcode and the device to recognise the font I need and have included.

A couple of PSs.

Two questions

  1. Why don’t Apple use a ‘default’ font if requested font  not found?

  2. Why does Corona simulator allow either upper or lower case names while Apple does not? Creates a  large scope for error and time waste. Is this an easy ‘improvement’ for corona (or what is the benefit as is?

Sorry about the one way conversation here…

Ref Scaling across devices iphone and iPads -all types. My Own Scaling code worked without a config file. But did not work perfectly when using a config file. I have since found if I leave out ‘letter box’, all is fine and dandy! i.e works well and all scenes fit the display perfectly.

I guess this is only of interest to those new to this …

Finally I have decided to move on!!!  I have failed to get the font to show. I have instead now used a condensed system font. So now my App is ok on the Xcode simulator…

Ref discussion

http://www.coronalabs.com/blog/2011/07/13/custom-fonts-corona/

and notes and comments there-in

"

_ NOTE: Some fonts do not display for whatever reason.
Often, it’s how the font file was built (slightly corrupted—sometimes
you get these from free font sites), so if you just can’t get the font
to show up (be sure to test on device), then try another custom font to
rule out file corruption._

"

@cockle, sometimes talking to yourself helps solve your problems.  I’m glad you’ve worked everything out.  Yes, your case sensitivity problem was a lowercase i and an uppercase I.  It’s all it takes.

When you do not provide a config.lua, your app uses the device to scale.  That’s okay if you want to take responsibility to scale everything on your own.  Having a config.lua baselines all devices to a common coordinate/size system.  Corona deals with the scaling and if you are scaling and we are scaling, you get double.

As for the font, yea, not all of font files are good to use.

Hi Rob,

Talking yourself into thinking it was working is not all good (well at least it did function correctly in xcode simulator) but would you believe it , the app failed, yes failed on the device, after working in the xcode simulator!!!

These development tools take me back to ‘papertape’ debugging (1960’s) , where a small hole punch, not quite complete, sometimes was read and worked and  sometimes didn’t!

Anyway, the problem again was Case sensitivity on my image assets folder. The  name used was ‘image’ on the folder which worked in the simulator, but should have been ‘Image’ as in the code, which the device rejected.

But at last I have a working app section on the iPhone!!!

I must attend a better typing class, or get new glasses…

Thanks for your patience and experienced pointers.

Glasses helped me.