How to archive an NSArray of custom objects to file in Objective-C
问题 Can you show me the syntax or any sample programs to archive an NSArray of custom objects in Objective-C? 回答1: Check out NSUserDefaults . For Archiving your array, you can use the following code: [[NSUserDefaults standardUserDefaults] setObject:[NSKeyedArchiver archivedDataWithRootObject:myArray] forKey:@"mySavedArray"]; And then for loading the custom objects in the array you can use this code: NSUserDefaults *currentDefaults = [NSUserDefaults standardUserDefaults]; NSData *savedArray =