PDA

View Full Version : App restarting device




counciler
Feb 23, 2012, 10:24 AM
I created a basic timer/random number generator app. I have a tick for the timer and a noise when the number is generated. I'm currently using AVAudioPlayer for it, though I'm planning on switching to OpenAL once I learn it. Now, twice so far, when I start playing the timer or random number, the app instantly shows the Apple logo, as if it's been restarted. It happens very quickly, normally the phone takes a few seconds just to shut down. I've used the app on the go and it wasn't attached to a debugger during the times it's happened, it's not consistent. Though I don't know if a debugger could help me here, these things are supposed to be sandboxed and not doing things like restarting my phone. I have the creeping suspicion it has to do with the sound since AVAudioPlayer has only given me problems since I started using it.



xStep
Feb 24, 2012, 10:10 PM
Use to Analyzer to check your code. In Xcode 4 that is Analyze under the Product menu. Once you fix identified issues here, try running it again.

The next step would be to Profile the executing app. You choose Profile under the Product menu. That runs Instruments. The common choices to use from the panel that first pops up is to use Leaks. There are several tools in it you could use.

If you do crash when connected to Xcode, you want to figure out where it is crashing. Setting a break point at that line will stop the code at that line before it executes allowing you to investigate parameters for the line. Many people use NSLog() to zero in on issues.

Oh, your app writes to a log when it crashes. You maybe be able to get that and review where the crash was. I'm still learning about the details for this.