从Xcode 6重新建立应用程序时OSStatus错误2003334207 [英] OSStatus error 2003334207 while re-buiding the App from Xcode 6

查看:879
本文介绍了从Xcode 6重新建立应用程序时OSStatus错误2003334207的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am using AVAudioPlayer to play recorded audio which is saved in Iphone's Document directory. When I first record an audio and then play, it works fine (Device is connected to the system and App is running through Xcode).

但是当我通过Xcode停止正在运行的应用程序并再次通过Xcode运行应用程序,我收到错误错误域= NSOSStatusErrorDomain代码= 2003334207操作无法完成。(OSStatus错误2003334207。)

But when I Stop the running App through Xcode and again run the App through Xcode, I am getting Error 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

I am using Xcode 6 and running App in IOS 8

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

P.S: I have read so many documentations related to this issue and also several questions in statckoverflow itself, but I didn't find the answer.

推荐答案

在iOS8下,您保存的路径在启动时无效。您看到的410AB24E-5FB0-4401-AC59-3C03D676E951ID将随每次启动而变化。

Under iOS8, the path that you have saved won't be valid across launches. The id you see "410AB24E-5FB0-4401-AC59-3C03D676E951" will change with each launch.

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

The solution is to save the filename and not the complete path, and to recreate the URL or complete path, by getting the path to the Documents (or tmp) folder and appending the filename to it.

这篇关于从Xcode 6重新建立应用程序时OSStatus错误2003334207的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆