素早いサウンドを再生するには、読み込み時間が短いため、AudioPlayer よりも SystemSound を好みます。しかし、Xcode 4.5.2 にアップグレードしたところ、ARC コードを使用してオーディオ スニペットを再生できなくなりました。以下の完全なコードを参照してください。私が得るエラーは次の行からのものです: AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID); 次のエラー メッセージで赤色のエラーが発生します: C ポインター型 CFURL への目的型 NSURL のキャスト (別名 const dtruct)。この行をどのように置き換えることができますか??`
NSString *path = [NSString stringWithFormat:@"%@%@", [[NSBundle mainBundle] resourcePath], @"/click.mp3"];
SystemSoundID soundID;
NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO];
// here is the problem line
AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID);
AudioServicesPlaySystemSound(soundID);