Possible bugs after applicationResume with latest builds

  1. I have an animation running on the screen inside a group. On the simulator, I click on the Suspend option in the menu, resume back, click on the screen to move my character and everything is fine. When I try it on my iPad, when I resume and move the character, the original animation stay there and Corona adds one out of the group (which is part of multiple groups to have a parallax effect). 

  2. Also, I have a timer with the code below:

       lTimer[1] = timer.performWithDelay(900000, RefreshConditions, 0)

    Is it normal that when you come back from suspend, the timer calls the RefreshConditions function even if the time is not up? I tried putting the timer in pause with the code below but when I the iPad resume, the function is always called, how can I prevent this?

   if event.type == “applicationSuspend” then

  

               for i=1, #lTimer do

                    timer.pause( lTimer[i] )

               end

               transition.pause()

     elseif event.type == “applicationResume” then

               for i=1, #lTimer do

                     timer.resume( lTimer[i] )

               end    

               transition.resume()

     end

  

Also, do I need to pause the transitions (like I did above) when you suspend or Corona will do it ?

Thanks

It doesn’t hurt to pause them.  I would think they would stop while suspended on their own but since time is involved, it might be safer to pause them.

As for the timer question, I conducted a test on the simulator (2119) and on my iPhone 5/iOS 7.0.4 with this code:

local t = timer.performWithDelay(10000, function() print("Timer Fired"); end, 1) local function systemListener(event)     print("event.type", event.type)     if event.type == "applicationSuspend" then         print("Suspending")         timer.pause(t)     elseif event.type == "applicationResume" then         print("resuming")         timer.resume(t)     end end Runtime:addEventListener( "system", systemListener )

I started the app, and using the stopwatch on my iPad, I paused the app at 4 seconds, resumed it at 8 seconds (4 seconds of suspend) and watched the timer fire at 14 second.  This would appear to be the desired behavior.

Rob

Rob, how can you tell that with your iPhone the timer was paused with a print function? On the simulator, It’s ok also on my side, it’s on the iPad that the function is called when resumed. With the exact code I wrote above. 

Claude

The code you posted above is incomplete (i.e. I couldn’t copy/paste it to test) and I didn’t feel like waiting 15 minutes to test.  I tethered my iPhone to my mac and using XCode’s organizer, I can watch the console log.  If you are not aware of how to do that, please read:  http://www.coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/

I re-ran my tests on my iPad 4 (iOS 7.0.4) and got identical results.

Ok. My next step is to send you the entire project and ask for professional services (which I did from your services page) and I will gladly pay you guys to optimize and find a solution for a couple of bugs I have in my code. 

Thank you, will wait for your reply for services. 

Claude

It doesn’t hurt to pause them.  I would think they would stop while suspended on their own but since time is involved, it might be safer to pause them.

As for the timer question, I conducted a test on the simulator (2119) and on my iPhone 5/iOS 7.0.4 with this code:

local t = timer.performWithDelay(10000, function() print("Timer Fired"); end, 1) local function systemListener(event)     print("event.type", event.type)     if event.type == "applicationSuspend" then         print("Suspending")         timer.pause(t)     elseif event.type == "applicationResume" then         print("resuming")         timer.resume(t)     end end Runtime:addEventListener( "system", systemListener )

I started the app, and using the stopwatch on my iPad, I paused the app at 4 seconds, resumed it at 8 seconds (4 seconds of suspend) and watched the timer fire at 14 second.  This would appear to be the desired behavior.

Rob

Rob, how can you tell that with your iPhone the timer was paused with a print function? On the simulator, It’s ok also on my side, it’s on the iPad that the function is called when resumed. With the exact code I wrote above. 

Claude

The code you posted above is incomplete (i.e. I couldn’t copy/paste it to test) and I didn’t feel like waiting 15 minutes to test.  I tethered my iPhone to my mac and using XCode’s organizer, I can watch the console log.  If you are not aware of how to do that, please read:  http://www.coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/

I re-ran my tests on my iPad 4 (iOS 7.0.4) and got identical results.

Ok. My next step is to send you the entire project and ask for professional services (which I did from your services page) and I will gladly pay you guys to optimize and find a solution for a couple of bugs I have in my code. 

Thank you, will wait for your reply for services. 

Claude