Schreiben von NSDictionary, um in meinem App-Bundle zu landen
Ich versuche, ein NSDictionary in eine Plist zu schreiben, aber wenn ich die Plist öffne, wurden keine Daten in sie geschrieben. Aus dem Protokoll sieht mein Pfad korrekt aus und mein Code ist ziemlich normal. Irgendwelche Ideen?
NSArray *keys = [NSArray arrayWithObjects:@"key1", @"key2", @"key3", nil];
NSArray *objects = [NSArray arrayWithObjects:@"value1", @"value2", @"value3", nil];
NSDictionary *dictionary = [NSDictionary dictionaryWithObjects:objects forKeys:keys];
for (id key in dictionary) {
NSLog(@"key: %@, value: %@", key, [dictionary objectForKey:key]);
}
NSString *path = [[NSBundle mainBundle] pathForResource:@"FormData" ofType:@"plist"];
NSLog(@"path:%@", path);
[dictionary writeToFile:path atomically:YES];