我用Xcode5.1.1开发了我的游戏应用程序。昨天我下载了Xcode 6.1.1。在Xcode6.1.1中,当我上传任何iOS 8.1模拟器时,声音都不起作用。然而,声音在所有iOS 7模拟器上都工作得很好。我正在为我的.aiff声音使用AudioToolbox.framework。iOS 7和iOS 8应用程序之间存在编码差异吗?或者是其他原因?
在我的ViewDidLoad里,声音的代码...
NSURL *SwishURL =[NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"SwishSound" ofType:@"aiff"]];
AudioServicesCreateSystemSoundID((__bridge CFURLRef)SwishURL, &SwishID);发布于 2015-03-31 00:42:45
其实现方式如下:
@import AudioToolBox;
@import AVFoundation;
NSString *soundPath = [[NSBundle mainBundle] pathForResource:@"sound_effect" ofType: @"wav"];
NSURL *soundURL = [NSURL fileURLWithPath:soundPath];
AVAudioPlayer *sound = [[AVAudioPlayer alloc] initWithContentsOfURL:soundURL error:nil];
[sound play];https://stackoverflow.com/questions/27205105
复制相似问题