声音仅在iPhone模拟器中播放,而不在设备上播放

时间:2013-11-03 01:14:05

标签: objective-c ios-simulator core-audio

所有

我有一个播放.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;

}

0 个答案:

没有答案