尝试设置(空)audio设备采样率的错误“!dat”

我试图播放一个audio剪辑(使用AVAudioPlayer)和一个video剪辑(使用MPMoviePlayerController),这两个工作。

然后,我将这些文件检入到SVN中,并在另一台Mac上删除它们。 现在,当我尝试播放audio或video时运行应用程序(iPad应用程序)时,都会显示以下错误:

尝试设置(空)audio设备采样率的错误“!dat”

考虑到SVN破坏了文件,(即使Mac的QuickLook也能正常播放),我用Mac上的版本replace了它们。 不过,我仍然收到错误。

所有代码在两台机器上都完全相同,但是原来使用的Mac(MacBook Pro)将在模拟器中同时播放它们,但在第二台Mac(Mac Pro)上,它们将不会播放并出现此错误。

有谁知道这个错误是什么意思,或者我可以修复它(因为覆盖媒体文件不工作)

谢谢

播放audio的代码:

NSError *error; [[AVAudioSession sharedInstance] setDelegate:self]; [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil]; [[AVAudioSession sharedInstance] setActive:YES error:&error]; NSURL *url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/Page_7.m4a", [[NSBundle mainBundle] resourcePath]]]; if (audioPlayer == nil) { audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error]; audioPlayer.numberOfLoops = 0; } if (audioPlayer == nil) NSLog(@"%@", [error description]); else [audioPlayer play]; 

更新:如果我在我的iPad上运行它(从我的Mac Pro)video播放良好。 它只是不会在我的Mac Pro的模拟器上播放

几天有同样的问题(非常讨厌)。 我设法通过在系统首选项下改变audio的input设置来修复它。

系统首选项 – >声音 – >input

我有同样的问题。 这是我做的:

  • closuresxcode和iOS模拟器
  • 拔下耳机插孔和任何可能有的USB耳机
  • 重新启动xcode并运行你的模拟(问题应该被解决)
  • 重新插入任何你想使用的audio设备

又一次重新安装,它终于工作。 仍然不知道问题是什么