Comment accéder à un fichier crashSound.wav
que j'ai placé dans le dossier Supporting Files de mon projet xCode? Parce que le code suivant ne fonctionne pas:Comment charger un fichier son en utilisant 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
Merci pour le conseil. Fera tout de suite. –