The app crashes while trying to fetch data from path/URL (video file stored in documents folder) only for large files (>100 MB).
Device Details: iOS (4.3), iPad 1
- URL is perfect (Checked logs)
- File exists at that path (checked path)
Note: Crashes on device only.
Below is the code where app crashes:
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]);
Any comments.