App works in simulator, doesn't work on actual device

Recently, I programmed an app. I tested it in the simulator and it works just fine, but then, when I try it on an actual device, it doesn’t work.

Background: the app consists of many games and json calls.

All the games work, but one is continuing to cause problems. I have another very similar game that does work, but even if I copied the code and changed the variables that I needed to change, this other one does not work well.

I just want to know if it’s a runtime error or what… both games are basically the same thing, just rerouted to other folders withing the app…

Try some of the suggestions here…

http://forums.coronalabs.com/topic/35663-app-works-fine-in-corona-simulator-but-not-in-xcode-simulator-or-device-any-ideas/?hl=cockle#entry184751

Could filename case sensitivity, or fonts missing on device. Try sticking with Helvetica fonts to begin with.

okay! Thanks for the advice on case sensitivity, that saved lots of problems, but I can’t still quite figure out what’s wrong with this game.

It stalls at the very beginning or halfway through… then something happens and it just stops working.

About the fonts, I use the native.SystemFont

I will read on to that forum and see if I can find anything… this is just so confusing!

Don’t know what it could possibly be… I tried everything I can with this code… and it just won’t work in the device.
 
The game consists of several questions, of which people have to choose an answer from the ones provided at the bottom of the screen. When you answer correctly, there’s a sliding out motion that takes away the last question and inserts the new one.
 
The problem here is, I call the ending screen with a delay of 1 minute and 20 seconds, but… it appears just about at the third question or even the second question, when not even 15 seconds have passed.
Then, when the minute 20 seconds pass, the ending screen appears again!
I really don’t know what may be causing that… but I’ll leave the code where you call the next questions here:
 

function nextQuestion() -- update screen var oldScreen = newScreen -- update question number index currQuestion = currQuestion+1 if currQuestion \> #playOrder then currQuestion = 1 end local questionNumber = playOrder[currQuestion] x=#content q2=math.random(1, x) q3=math.random(1, x) newScreen=display.newGroup() img1= display.newImageRect("Alumnos/sumasCD/source/images/pics/"..content[questionNumber].id..".png",250, 250, true) img1.x=400 img1.y=350 img2= display.newImageRect("Alumnos/sumasCD/source/images/pics/"..content[q2].id..".png",250, 250, true) img2.x=700 img2.y=350 if(difficulty==4)then img3=display.newImageRect("Alumnos/sumasCD/source/images/pics/"..content[q3].id..".png",250, 250, true) img3.x=800 img3.y=350 img1.x=250 img2.x=530 newScreen:insert(img3) end newScreen:insert(img1) newScreen:insert(img2) -- do transitions transitionIn(newScreen) transitionOut(oldScreen) -- make buttons letterButtons = {} local buttonColors = factory.getRandomColors(difficulty) -- determine upper or lower case isLowerCase = math.random(1,2) == 1 -- make letter button for correct letter total1=content[questionNumber].value total2=content[q2].value total=total1+total2 if(difficulty==4) then total3=content[q3].value total=total+total3 if(content[questionNumber].cat==1 and content[q2].cat==1 and content[q3].cat==1)then total=total..".00" end if(content[questionNumber].cat==2 or content[q2].cat==2 and content[q3].cat==2)then total=total.."0" end elseif(content[questionNumber].cat==1 and content[q2].cat==1)then total=total..".00" elseif(content[questionNumber].cat==2 or content[q2].cat==2 )then if(content[questionNumber].value==.5 and content[q2].value==.5) then total=total..".00" else total=total.."0" end end letter=total table.insert(letterButtons, factory.newLetterButton(letter, isLowerCase, buttonColors[1])) correctButton = letterButtons[1].graphics local buttonWidth = correctButton.width -- make other letter buttons local letters = factory.getRandomLetters(difficulty-1, letter) for i=1, difficulty-1 do table.insert(letterButtons, factory.newLetterButton(letters[i], isLowerCase, buttonColors[i+1])) end -- position letter buttons and add touch event listener local randomLetterOrder = factory.getRandomOrder(#letterButtons) local buttonSpacing = 260 local buttonsWidth = (#letterButtons \* buttonWidth) + ((#letterButtons-1) \* (buttonSpacing/4)) local buttonsX = centerX - (buttonsWidth/2) + 300 for i=1, #letterButtons do local button = letterButtons[i].graphics button.y = 600 button.x = buttonsX + (buttonSpacing \* (randomLetterOrder[i]-1)) button:addEventListener("touch", onLetterTouch) local randomDelay = transitionDuration + (math.random(1,10) \* 10) transition.from(button, {time = 500, delay = randomDelay, y = defaultHeight + button.height, transition=easing.easeOutElastic}) end -- play bubbles sound when letters animate in timer.performWithDelay(transitionDuration, playBubbles) end

Hi,

Are you saying it works as expected -randomizing in the simulator but not totaly on the device-only partly ? This  would be something related to maths support or device versus test machine environment speeds -{just some guess work here!}.

Without more detail of all the functions and variable setting [factory.randomorder, plus many variable[transitionDuration]  ]  you are calling here, my suggestion would be to ‘simplify’ the randomising of the transition calculation and random delays.   Use   fixed values  maybe set up in a table , selected in a  known order until you can get it working.

Then place in changes for random an see if that effects the sequencing as expected.

Alec

Try some of the suggestions here…

http://forums.coronalabs.com/topic/35663-app-works-fine-in-corona-simulator-but-not-in-xcode-simulator-or-device-any-ideas/?hl=cockle#entry184751

Could filename case sensitivity, or fonts missing on device. Try sticking with Helvetica fonts to begin with.

okay! Thanks for the advice on case sensitivity, that saved lots of problems, but I can’t still quite figure out what’s wrong with this game.

It stalls at the very beginning or halfway through… then something happens and it just stops working.

About the fonts, I use the native.SystemFont

I will read on to that forum and see if I can find anything… this is just so confusing!

Don’t know what it could possibly be… I tried everything I can with this code… and it just won’t work in the device.
 
The game consists of several questions, of which people have to choose an answer from the ones provided at the bottom of the screen. When you answer correctly, there’s a sliding out motion that takes away the last question and inserts the new one.
 
The problem here is, I call the ending screen with a delay of 1 minute and 20 seconds, but… it appears just about at the third question or even the second question, when not even 15 seconds have passed.
Then, when the minute 20 seconds pass, the ending screen appears again!
I really don’t know what may be causing that… but I’ll leave the code where you call the next questions here:
 

function nextQuestion() -- update screen var oldScreen = newScreen -- update question number index currQuestion = currQuestion+1 if currQuestion \> #playOrder then currQuestion = 1 end local questionNumber = playOrder[currQuestion] x=#content q2=math.random(1, x) q3=math.random(1, x) newScreen=display.newGroup() img1= display.newImageRect("Alumnos/sumasCD/source/images/pics/"..content[questionNumber].id..".png",250, 250, true) img1.x=400 img1.y=350 img2= display.newImageRect("Alumnos/sumasCD/source/images/pics/"..content[q2].id..".png",250, 250, true) img2.x=700 img2.y=350 if(difficulty==4)then img3=display.newImageRect("Alumnos/sumasCD/source/images/pics/"..content[q3].id..".png",250, 250, true) img3.x=800 img3.y=350 img1.x=250 img2.x=530 newScreen:insert(img3) end newScreen:insert(img1) newScreen:insert(img2) -- do transitions transitionIn(newScreen) transitionOut(oldScreen) -- make buttons letterButtons = {} local buttonColors = factory.getRandomColors(difficulty) -- determine upper or lower case isLowerCase = math.random(1,2) == 1 -- make letter button for correct letter total1=content[questionNumber].value total2=content[q2].value total=total1+total2 if(difficulty==4) then total3=content[q3].value total=total+total3 if(content[questionNumber].cat==1 and content[q2].cat==1 and content[q3].cat==1)then total=total..".00" end if(content[questionNumber].cat==2 or content[q2].cat==2 and content[q3].cat==2)then total=total.."0" end elseif(content[questionNumber].cat==1 and content[q2].cat==1)then total=total..".00" elseif(content[questionNumber].cat==2 or content[q2].cat==2 )then if(content[questionNumber].value==.5 and content[q2].value==.5) then total=total..".00" else total=total.."0" end end letter=total table.insert(letterButtons, factory.newLetterButton(letter, isLowerCase, buttonColors[1])) correctButton = letterButtons[1].graphics local buttonWidth = correctButton.width -- make other letter buttons local letters = factory.getRandomLetters(difficulty-1, letter) for i=1, difficulty-1 do table.insert(letterButtons, factory.newLetterButton(letters[i], isLowerCase, buttonColors[i+1])) end -- position letter buttons and add touch event listener local randomLetterOrder = factory.getRandomOrder(#letterButtons) local buttonSpacing = 260 local buttonsWidth = (#letterButtons \* buttonWidth) + ((#letterButtons-1) \* (buttonSpacing/4)) local buttonsX = centerX - (buttonsWidth/2) + 300 for i=1, #letterButtons do local button = letterButtons[i].graphics button.y = 600 button.x = buttonsX + (buttonSpacing \* (randomLetterOrder[i]-1)) button:addEventListener("touch", onLetterTouch) local randomDelay = transitionDuration + (math.random(1,10) \* 10) transition.from(button, {time = 500, delay = randomDelay, y = defaultHeight + button.height, transition=easing.easeOutElastic}) end -- play bubbles sound when letters animate in timer.performWithDelay(transitionDuration, playBubbles) end

Hi,

Are you saying it works as expected -randomizing in the simulator but not totaly on the device-only partly ? This  would be something related to maths support or device versus test machine environment speeds -{just some guess work here!}.

Without more detail of all the functions and variable setting [factory.randomorder, plus many variable[transitionDuration]  ]  you are calling here, my suggestion would be to ‘simplify’ the randomising of the transition calculation and random delays.   Use   fixed values  maybe set up in a table , selected in a  known order until you can get it working.

Then place in changes for random an see if that effects the sequencing as expected.

Alec