Accelerometer lag when resuming from suspension mode

I have a problem when running my game on iOS.

When I suspend the application by pressing the Home or Start button and then come back into the app it sometimes gives me the Warning: 

 

backboardd[28] <Warning>: CoreAnimation: updates deferred for too long

(no more warnings/errors)

 

and this makes the accelerometer acting weird for some seconds (5-10 sec). The accelerometer is not responding directly, it takes like 2 seconds for it to respond. After 5-10 seconds the accelerometer goes back to normal. 

 

I remove all Runtime events when I suspend and then turn them back on when I resume.

I use ads. should I also somehow disable them on suspend?

 

I also pause all  sprite animations on suspend…

Hi @ivan.liljeqvist,

Can you temporarily remove the ads, so that it may be determined if they’re the issue instead of the accelerometer? It would be useful to isolate a test case for this.

Thanks,

Brent

Hi, thank you for answering! :smiley:

Sadly, removing the ads didn’t solve it…

I’m thinking, is there no way to tell CoreAnimation to stop listening for updates at all? just ignore everything that’s happening when suspended?

Also, I’m calling audio.stop() when I suspend and sometimes I get this message:

<Warning>: Error setting audio session active to 0! ‘!act’

Sometimes this does no harm at all, but sometimes

<Warning>: CoreAnimation: updates deferred for too long

is called directly after. Does CoreAnimation has to do something with sound?

Otherwise I don’t get any warnings/errors from the Xcode console.

I removed everything that has to do with audio.

DIDN’T HELP!  :wacko:

So the entire day I’ve experimented.

Disabled ads - didn’t help.

Disabled audio - didn’t help.

I tried it on different iOS devices with different iOS versions - same problem everywhere.

I disabled accelerometer and tried suspending/resuming and it still gives me:

backboardd[28] <Warning>: CoreAnimation: updates deferred for too long

I disabled all recurring timers, paused all sprite animations NOTHING HELPS!

Don’t really know what to do now.

What is usually causing “CoreAnimation: updates deferred for too long”?

What do you think?

Hi @ivan.liljeqvist,

Let me ask the engineers about this and see what input they have.

Thanks,

Brent

More discoveries today.


  1. Sometimes when the accelerometer lags, the buttons stop also to respond.

  2. On an old iPhone 4 the warning (  <Warning>: CoreAnimation: updates deferred for too long ) comes up when you run the application for the first time.  This leads to accelerometer lag + buttons not responding. So this problem is not only when you suspend and resume.

 On this old iPhone 4 “<Warning>: CoreAnimation: updates deferred for too long” comes up and messes up the accelerometer and buttons on resume after suspend also.

The effects on iPhone 4 seem to be much worse compared to iPhone 5. The accelerometer and buttons lag for longer time and it happens more frequently.


I honestly don’t know how it can possibly defer something when the app just started…

What did the engineers say? What is causing the CoreAnimation error?

Hi Ivan,

I haven’t received a response yet, but I’ll let you know when I hear back. Out of curiosity, can you please provide us with your system details?

  1. Which build # of Corona SDK are you using?

  2. Which version of OS X?

Thanks,

Brent

Hi!

Corona Version 2014.2189 (2014.3.6)

OS X 10.9.3 (13D65)

Hi Ivan,

The engineers will need a bug case/report filed for this, as by our standard. Can you create a simple test project which shows this issue and submit it as a bug?

Thanks,

Brent

Hi!

Never done it before. What exactly do you mean by test project. Corona project?

Nevermind, found instructions on the website. Will do!

So I tried to do a test project, but my game is too complex to isolate the problem. 

However, after all this struggle I found a solution!

It turned out that if you disable accelerometer on suspend and then WAIT 1/3 of a second after resuming before turning the accelerometer on the warning doesnt show!

I guess CoreAnimation can catch up during that time. This worked on all iOS devices I have.

During this 1/3 of a second I just write “Get ready!” on the screen masking this bug as a feature. 

So everything is fine now!

Great to hear Ivan! Hope your game goes well.

Thank you!

Hi @ivan.liljeqvist,

Can you temporarily remove the ads, so that it may be determined if they’re the issue instead of the accelerometer? It would be useful to isolate a test case for this.

Thanks,

Brent

Hi, thank you for answering! :smiley:

Sadly, removing the ads didn’t solve it…

I’m thinking, is there no way to tell CoreAnimation to stop listening for updates at all? just ignore everything that’s happening when suspended?

Also, I’m calling audio.stop() when I suspend and sometimes I get this message:

<Warning>: Error setting audio session active to 0! ‘!act’

Sometimes this does no harm at all, but sometimes

<Warning>: CoreAnimation: updates deferred for too long

is called directly after. Does CoreAnimation has to do something with sound?

Otherwise I don’t get any warnings/errors from the Xcode console.

I removed everything that has to do with audio.

DIDN’T HELP!  :wacko:

So the entire day I’ve experimented.

Disabled ads - didn’t help.

Disabled audio - didn’t help.

I tried it on different iOS devices with different iOS versions - same problem everywhere.

I disabled accelerometer and tried suspending/resuming and it still gives me:

backboardd[28] <Warning>: CoreAnimation: updates deferred for too long

I disabled all recurring timers, paused all sprite animations NOTHING HELPS!

Don’t really know what to do now.

What is usually causing “CoreAnimation: updates deferred for too long”?

What do you think?

Hi @ivan.liljeqvist,

Let me ask the engineers about this and see what input they have.

Thanks,

Brent