Jak zapisać plik w folderze dokumentów?
Próbuję zapisać dane w folderze dokumentów na symulatorze iPhone 5.1.
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");
}
Zawsze mam „Not Writable”. Dowolny pomysł? Proszę pomóż mi.