【发布时间】:2012-06-13 13:47:44
【问题描述】:
应用程序在尝试仅针对大文件 (>100 MB) 从路径/URL(存储在文档文件夹中的视频文件)获取数据时崩溃。
设备详情:iOS (4.3)、iPad 1
- 网址完美(已检查日志)
- 文件存在于该路径(检查路径)
注意:仅在设备上崩溃。
以下是应用崩溃的代码:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
if ([paths count] > 0)
{
filePath = [paths objectAtIndex:0];
filePath = [filePath stringByAppendingPathComponent:@"Private Documents"];
filePath = [filePath stringByAppendingPathComponent:@"videos"];
filePath = [filePath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.mp4",st]];
}
NSURL *fileUrl=[NSURL fileURLWithPath:filePath];
NSMutableData *Data = [NSMutableData dataWithContentsOfURL:fileUrl]; //CRASHES ON THIS LINE
NSLog(@"Data: %d",[Data length]);
任何cmets。
【问题讨论】:
-
你能告诉我fileURL的声明吗
-
感谢詹姆斯的关心。我用更多代码编辑问题。
-
最重要的是:崩溃说明了什么?
-
当我在后台执行此操作时,我 rcv: ,收到内存警告。 Level=1 ,收到内存警告。 Level=2 然后崩溃
标签: ios objective-c cocoa-touch crash nsmutabledata