2

I am trying to figure out a "Failed to resume in time" problem. In one of our testers devices (which is an iPhone 4S with the latest OS) it happens very frequently, whereas in my own device it doesn't seem to happen at all.

Anyway, I got a few crashlogs. I am unable to trace the root of the cause though. I understand that the issue might be

1.When a process is holding up the main thread for too long.

2.When there is a memory issue.

I don't think the memory is much of an issue since it seems to happen when the user leaves the main menu and comes back. Nothing much is happening in the main menu so it probably is a task that runs too long.

Here is an excerpt from the crash log:

Can somebody help me or guide me on who I can trace the cause of the issue? Is there anyway to turn off the watchdog timer(probably not huh?) Also, what does highlighted thread refer to?

  1. I have already checked my applicationDidBecomeActive & applicationWillEnterForeground to make sure there is nothing going on there.

  2. To my knowledge there are no synchronous calls being made at this point. Does Reachability use synchronous calls to check for internet? How can I check for that?

  3. I am not making any large data transfers upon resume.

  4. I notice that GameCenter automatically logs in or check for log in upon resuming your app. Is there anyway to prevent this? Could this possibly cause a time out issue?

I tried doing a time profile, but I am not able to understand how to use it to analyze. If you can provide a good resource for that, that would be amazing.

Thanks!!!

AbhinavVinay
  • 303
  • 6
  • 18
  • This may or may not be helpful: http://stackoverflow.com/questions/7945016/how-to-optimize-mach-msg-trap?lq=1 I would check all cases where you run things concurrently, ie performSelectorInBackground and GCD. – CodeSmile Jul 16 '12 at 23:12
  • No luck yet man. I don't know what are the processes that are happening when I bring my app back from the background. How do I see what is happening? – AbhinavVinay Jul 17 '12 at 00:23
  • So this only happens when resuming from background? You should mention that (clearly) in the question. I'll add my comment as an answer because this is the best I can offer atm. – CodeSmile Jul 18 '12 at 23:04

1 Answers1

1

You're currently in "trying to find the issue mode". You should switch to "try to find out how much of an issue this really is" mode.

So go find another 4S (actually as many as you can) to rule out that it's a device-specific issue. If it happens on all 4S it should be easier to pinpoint. If not, have someone else look over it, discuss possible causes. The peer programming approach often helps when you're stuck in a dead-end situation.

If the issue is only on that one device, you might want to check if it's broken (or "jailbroken") or might simply need a hard reboot (hold power and home for 10+ seconds).

If it only happens on some devices but not all, try to find what they have in common. This could be language/locale, or dictation, practically any kind of setting the user might have changed. If necessary, write a logger that logs as many settings as possible to your (web) server so you can compare settings one-by-one and quickly discard those that aren't in synch.

If only very few devices are affected, you could also ignore the issue and hope that additional crash logs from users will reveal the key to the issue.

Finally, there's always the option to disable suspend on terminate and instead terminate the app when the home button is pressed (as it was pre iOS 4). Unless of course the app has to run in background.

CodeSmile
  • 64,284
  • 20
  • 132
  • 217
  • Hi,Yeah my bad, I should have been more clear in my question. It seems to happen on other devices too. Just not often though. I have used Instruments to check for memory build up and there isn't any. Upon playing the game continuously for long as well as upon several restarts there doesn't seem to be any memory accumulation. The problem seems to be when the app is left in the background for long and then the user comes back. – AbhinavVinay Jul 18 '12 at 23:33
  • I have noticed in Temple Run that when you are playing the game and you leave the game and come back immediately it takes you to the pause screen. But if you come back much later, it takes you to a loading screen for a while before showing you the pause screen. Do you by any chance know why this is or what they do at this time? I also suspect maybe the way I load the sounds could be an issue. I currently use SimpleAudioEngine for playing the background music. As for the sounds I use CDAudioManager, I use SoundEngine to preload the effects and then play it when needed. – AbhinavVinay Jul 18 '12 at 23:42
  • I really can't think why this issue seems to persist when I seem to have followed the best practices that I am aware of. Is there anything specific i should do while handling the app when it exits or enters? I am currently working by myself, so peer review isn't an option at present :( Thank you for your time. Do let me know if you can offer any other pointers. Thanks. – AbhinavVinay Jul 18 '12 at 23:42