プロジェクトのコーディングは完了しましたが、ソース コードをクライアントに提出したときにテストを行ったところ、メモリ リークが検出されました。でテストしましたInstruments using Leaks
。私が問題を抱えているのは、私のものと私のもの、そして私のものAVPlayer
です。これについて代替を見つける必要がありますか?または私のコードに何か問題がありますか?AVAudioPlayer
AppDelegate
以下は私のコードです(ARC
ちなみに使用しています):
---> AppDelegate
int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([RootViewAppDelegate class]));
}
}
と
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[window makeKeyAndVisible];
---> AVPlayer
self.moviePlayer = [AVPlayer playerWithURL:[NSURL fileURLWithPath:moviePath]];
---> AVAudioPlayer
NSString* resourcePath = [[NSBundle mainBundle] resourcePath];
resourcePath = [resourcePath stringByAppendingString:@"/Normal.wav"];
NSLog(@"Path to play: %@", resourcePath);
NSError* err;
//Initialize our player pointing to the path to our resource
BGMplayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:resourcePath] error:&err];
if( err ){
//bail!
NSLog(@"Failed with reason: %@", [err localizedDescription]);
}
else{
//set our delegate and begin playback
BGMplayer.delegate = self;
[BGMplayer play];
BGMplayer.numberOfLoops = -1;
BGMplayer.currentTime = 0;
BGMplayer.volume = 1.0;
}
上記のものを検出する方法は次のとおりです。
誰かが私を助けてくれることを願っています.メモリリークを検出するのはこれが初めてです。では、ご指導よろしくお願いします。どうもありがとうございます。