I want to close all file after reading it. Actually, i want to remove safely the SD Card, so that i need to close all file before eject but i don't know how to close file. I used the code to reading file:
NSError *error = nil;
NSURL *url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/test.txt", drive_url]];
NSLog(@"url %@",url);
NSMutableData *dataText = [NSMutableData dataWithContentsOfURL:url options:NSDataReadingUncached error:&error];
if (error) {
NSLog(@"%@", [error localizedDescription]);
}else {
NSLog(@"Data loaded successfully");
NSLog(@"Data %@",dataText);
}
How can i close test.txt file? Thanks in advance
File closes right after dataWithContentsOfURL:options:error: finished. NSDataReadingUncached is a hint indicating the file should not be stored in the file-system caches.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With