次のコードで
NSURL *file = [[NSURL alloc] initFileURLWithPath: [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:soundName]];
// NSData *data = [NSData dataWithContentsOfURL:file];
myExampleSound1 =[[AVAudioPlayer alloc] initWithContentsOfURL:file error:nil];
myExampleSound1.volume=0.9;
[myExampleSound1 prepareToPlay];
myExampleSound1.delegate = self;
[myExampleSound1 play];
[soundsArray addObject:myExampleSound1];
NSLog(@"RETAIN COUNT BEFORE RELEASE file = %d, myExampleSound1=%d, soundsArray=%d", [file retainCount],[myExampleSound1 retainCount], [soundsArray retainCount]);
[file release];
NSLog(@"RETAIN COUNT AFTER RELEASE file = %d, myExampleSound1=%d, soundsArray=%d", [file retainCount],[myExampleSound1 retainCount], [soundsArray retainCount]);
ファイルの保持カウントは、リリース前は 4、リリース後は 3 です。前もって感謝します