このメモリリークの問題を解決するには、いくつかの助けが必要です。ARCを使用しています。
潜在的なリークは次の行にあります。
NSURL *aFileURL = [NSURL fileURLWithPath:filePath isDirectory:NO];
コードは次のとおりです。
// === Check if the game should play sound === //
if (sound == YES) {
//==== PLAY THE LOOSING SOUND ====//
// Form a URL to the sound file, which in init using the Path
NSBundle *mainBundle = [NSBundle mainBundle];
NSString *filePath = [mainBundle pathForResource:@"wrong2" ofType:@"wav"];
NSURL *aFileURL = [NSURL fileURLWithPath:filePath isDirectory:NO];
// Create a sound ID,
SystemSoundID myID;
// Register the sound
AudioServicesCreateSystemSoundID((__bridge_retained CFURLRef)aFileURL, &myID) ;
// Play the sound!
AudioServicesPlaySystemSound(myID);
}