내 xcode 프로젝트의 Supporting Files 폴더에 넣은 crashSound.wav
파일에 어떻게 액세스합니까? 다음 코드가 작동하지 않기 때문에 :initWithContentsOfURL : error :?를 사용하여 사운드 파일을로드하는 방법
@interface Game()
{
// code...
AVAudioPlayer *crashSound;
// code...
}
@end
@implementation Game
- (id) init
{
// code...
NSURL *crashSoundFile = [[NSURL alloc] initWithString:@"crashSound" ]; // <--PROBLEM
crashSound = [[AVAudioPlayer alloc] initWithContentsOfURL:crashSoundFile error:NULL];
// code...
}
-(void) play // this is my "main" method that will be called once the playButton is pressed
{
[crashSound play];[crashSound play];[crashSound play];
}
@end
조언 해 주셔서 감사합니다. 바로 할 수 있습니다. –