Reputation: 1491
On iOS after using AVAudioPlayer to play a sound I observe that a thread continues to run and consume around 3% CPU. It seems related to the HAL stuff (Hardware Abstraction Layer). How to achieve a full cleanup and get my app idle ? It is referenced in a local var and properly deallocated after the play is ended. I've noticed that If I just instantiate the AVAudioPlayer but never call the play method, that thread is not created. And the app is idle. Any ideas?
Notice: I deprecate this question since I've realised that this issue is only on Simulator. Found the explanation here http://lists.apple.com/archives/coreaudio-api/2006/Jul/msg00022.html
Upvotes: 0
Views: 358
Reputation: 209
Try below code and set your audio player object to nil.
NSError *error;
[[AVAudioSession sharedInstance] setActive:NO withFlags:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation error:&error];
Upvotes: 0
Reputation: 2577
How is the exact name of the object which is using 3% cpu?
Have you tried running the App in instruments?
Especially check for leaks and where they are created.
Upvotes: 1