views:

446

answers:

6

The GUI of my application stops responding after the iPod has been in standby mode. The application I have made is based on the "Utility application" template from the wizard in xcode - but the original application still works after the iPod returns from standby. My application plays music (AudioUnit) and when the iPod enters standby the music stops but when the iPod leaves standby mode the music starts playing again but as mentioned the GUI does not respond to touches anymore. All I can do is to shut it down.

I have read about this problem here: http://stackoverflow.com/questions/411436/what-happens-to-an-iphone-app-when-iphone-goes-into-stand-by-mode

but that did not help me enough to solve the problem.

+1  A: 

Sounds like your Audio Unit has been stopped.

If your GUI relies on the AU's progress then that would explain the problem.

Check your AU's state in applicationDidBecomeActive.

I didn't think standby mode stopped AUs, I thought only audio interruptions did that. Anyway, you should probably look at AudioSessions as well, as you'll find that phone calls, alarms, SMSs and ipod music will also stop your Audio Unit.

Good luck.

Rhythmic Fistman
A: 

Actually, I've been running into this problem on the iPod application itself, in just general daily use. That is, if you are using the 3.0 firmware OS, then this is most likely a bug in the iPhone. I guess you can relax, and know that it's probably not your own code that is causing the problem. I'd file a radar ticket with Apple if you haven't already so that they can address it in the next bug fix release.

casademora
A: 

Thank you for responding.

I can trigger the problem by just turning the device off and on again while the application is running.

As mentioned, if a create a new project from one of the templates it does not have this problem. I have then tried uncommenting the part where I use the Audio Unit but that did not help. This has made me think that maybe it is also related to my project settings. How do you reset the project settings? Sometimes xcode crashes and asks me if I want to reset the project settings but right now I can't get it to crash.

A: 

I have now read some of this: http://developer.apple.com/IPhone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ApplicationEnvironment/ApplicationEnvironment.html

And implemented the applicationWillResignActive and the applicationDidBecomeActive methods but how do I make the GUI respond to touch events again? Should that not happen automatically?

A: 

It all happens just because I have an UISlider in an UIToolbar. If I remove the UISlider from my GUI it still responds after waking up from standby/sleep mode.

Can someone explain me why that causes this problem (is it a bug in Apple's code)?

A: 

The solution is here: http://www.iphonedevsdk.com/forum/iphone-sdk-development/4558-app-crashing-upon-quit.html

Simply don't put a slider in a toolbar. Make a work around so it looks like the slider is in the toolbar instead. It is a bug in Apple's code.