Reputation: 3234
After analyzing application found this message Object leaked : allocated object is not referenced later in this execution path and has a retain count of +1 on these lines
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"theme"
ofType:@"mp3"];
NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:filePath];
For this statement it says
self.audioPlayer.currentTime = 0;
object allocated and stored into fileURL is not referenced later in this exception path and has a retain count of +1
Any ideas how to fix it.
Thanks
Upvotes: 0
Views: 1818
Reputation: 34912
It's likely it's fileURL
that has leaked. You're alloc
-ing it but I bet you don't release it after you're done with it.
Upvotes: 2
Reputation: 100632
It means there's some path through your code (and it should be willing to show it to you) in which you fail to release fileURL
— probably you do some sort of sanity check and exit early under a certain circumstance but fail to clean up?
The obvious solution would be to create fileURL
as an autoreleased object and either retain it when you know you definitely want to keep it or simply do that instead of an explicit release further down the method.
Upvotes: 1