I am trying to save data in the documents folder on iPhone 5.1 simulator.
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [NSString stringWithFormat:@"%@/%@", documentsDirectory, @"myData.json"];
if ([[NSFileManager defaultManager] isWritableFileAtPath:filePath]) {
NSLog(@"Writable");
}else {
NSLog(@"Not Writable");
}
I’ve got always “Not Writable”.
Any idea? Please help me.
Maybe because you have not created the file, the file you tested does not exist. 🙂
You can do this to find the problem,