AVAudioPlayer 클래스에 이상한 문제가 있습니다. 속성 중 하나에 액세스하려고 할 때마다 null입니다.AVAudioPlayer isPlaying은 항상 null을 반환합니다.
// Get the file path to the song to play.
NSString *filePath = [[[NSBundle mainBundle] pathForResource:pSound.fileName
ofType:pSound.fileType] retain];
// Convert the file path to a URL.
NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:filePath];
NSError* err;
//Initialize the AVAudioPlayer
self.audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:fileURL error:&err];
if(err){
NSLog(@"Initializing failed with reason: %@", [err localizedDescription]);
}
else{
[self.audioPlayer setDelegate:self];
[self.audioPlayer prepareToPlay];
self.playCount = self.playCount + 1;
NSLog(@"%@", [self.audioPlayer isPlaying]); //this displays null; also if I call it at a later time
};
[filePath release];
[fileURL release];
어떤 아이디어?
편집 :
혹시이 문제를 해결하기 위해 관리나요 대신 [audioPlayer isPlaying]의)을 (audioPlay.playing를 사용할 수 있습니까? 나는 똑같은 문제를 안고있다. – Neeku