私はiPhoneプログラミングに不慣れです。以下のコードは録音されたサウンドを再生するためのものですが、デバイスでサウンドを再生しないことを誰かが教えてくれますか?このコードにどのような間違いがあるかを誰かが教えてくれますか?
if(soundID)
{
AudioServicesDisposeSystemSoundID(soundID);
}
//Get a URL for the sound file
NSURL *filePath = [NSURL fileURLWithPath:audiopath isDirectory:NO];
NSLog(@"%@",filePath);
//Use audio sevices to create the sound
AudioServicesCreateSystemSoundID((__bridge CFURLRef)filePath, &soundID);
//Use audio services to play the sound
AudioServicesPlaySystemSound(soundID);
上記のコードでは、オーディオパスは音声リコアパスです。実はデータベースパスにはこんな感じで保存されています
/Users/User/Library/Application Support/iPhone Simulator/5.0/Applications/C974262E-7658-45EE-8E8C-290B780E7C3E/Documents/2012-12-18 13:50:56 +0000.caf
この後、パスを取得している間、次のように表示されます。
file://localhost/Users/User/Library/Application%20Support/iPhone%20Simulator/5.0/Applications/C974262E-7658-45EE-8E8C-290B780E7C3E/Documents/2012-12-18%2013:50:56%20+0000.caf
このコードの間違いは何ですか?教えてください。