gpt4 book ai didi

ios - 从 Xcode 6 重新构建应用程序时出现 OSStatus 错误 2003334207

转载 作者:可可西里 更新时间:2023-11-01 03:06:53 26 4
gpt4 key购买 nike

我正在使用 AVAudioPlayer 播放保存在 Iphone 的文档目录中的录制音频。当我第一次录制音频然后播放时,它工作正常(设备连接到系统并且应用程序通过 Xcode 运行)。

但是当我通过 Xcode 停止正在运行的应用程序并再次通过 Xcode 运行该应用程序时,我收到错误 Error Domain=NSOSStatusErrorDomain Code=2003334207 "The operation couldn't be completed. (OSStatus error 2003334207.)"

文件位置:file:///var/mobile/Containers/Data/Application/410AB24E-5FB0-4401-AC59-3C03D676E951/Documents/26-06-2015--13:10:47.m4a

我的代码:

fileLocation = @"file:///var/mobile/Containers/Data/Application/410AB24E-5FB0-4401-AC59-3C03D676E951/Documents/26-06-2015--13:10:47.m4a"

NSURL *fileUrl = [NSURL URLWithString:fileLocation];
player = [[AVAudioPlayer alloc] initWithContentsOfURL:fileUrl error:&error];
[player setDelegate:self];

NSURL *fileUrl = [NSURL URLWithString:fileName];
player = [[AVAudioPlayer alloc] initWithContentsOfURL:fileUrl error:&error];
[player setDelegate:self];

我正在使用 Xcode 6 并在 IOS 8 中运行 App

P.S: 我已经阅读了很多与此问题相关的文档以及 statckoverflow 本身的几个问题,但我没有找到答案。

最佳答案

在 iOS8 下,您保存的路径在启动后将无效。您看到的 ID“410AB24E-5FB0-4401-AC59-3C03D676E951”会随着每次启动而改变。

解决方案是保存文件名而不是完整路径,并通过获取 Documents(或 tmp)文件夹的路径并将文件名附加到它来重新创建 URL 或完整路径。

关于ios - 从 Xcode 6 重新构建应用程序时出现 OSStatus 错误 2003334207,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31067989/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com