所有
我有一个播放.aiff文件的方法。一切都在模拟器中正常工作,但是当我在设备上运行时,没有声音呈现。我在我的设备上运行iOS 7,它可以在模拟器中运行iOS 7。
任何想法?
以下是方法:
-(void) playNote:(NSString *)noteVal {
AudioServicesDisposeSystemSoundID(soundId);
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef = CFBundleCopyResourceURL(mainBundle,(__bridge CFStringRef)noteVal, CFSTR("aiff"), NULL);
AudioServicesCreateSystemSoundID(soundFileURLRef, &soundId);
AudioServicesPlaySystemSound(soundId);
CFRelease(soundFileURLRef);
noteVal = nil;
}