0

我正在使用 ftp 协议在服务器上发送扩展名为 .m4a 的音频文件,首先我将此文件存储到我的文档目录路径中。我在控制台中获得了文档目录路径,如下所示:

NSLog(@"filepath=%@",filePath);
assert([[NSFileManager defaultManager] fileExistsAtPath:filePath]);

在 assert() 函数我的应用程序崩溃我不知道是什么原因。我的控制台如下:

filepath=/Users/macmini2/Library/Application Support/iPhone Simulator/5.1/Applications/B2CFB7FF-A4BF-4B83-8DD1-102C5680C16C/Documents/9_39.m4a
Assertion failed: ([[NSFileManager defaultManager] fileExistsAtPath:filePath])

如果您有任何解决方案,请提前提供thanx ...

4

1 回答 1

0

您要查找的文件很可能不存在。

要进行双重检查,请输入:

ls "/Users/macmini2/Library/Application Support/iPhone Simulator/5.1/Applications/B2CFB7FF-A4BF-4B83-8DD1-102C5680C16C/Documents/9_39.m4a" 

在终端窗口中。

如果您遇到错误,请检查您的构建方式filePath

如何使 9_39.m4a 文件在 iPhone 上可用?它是应用程序包的一部分吗?(您不应该在 Resources 文件夹中搜索它吗?)

于 2012-06-29T07:44:02.500 回答