开发者

Array writeToFile

开发者 https://www.devze.com 2023-01-16 14:27 出处:网络
Let\'s say I create an object like this: Person: NSString *name; NSString *phone; NSString *address I create several of these objects. Then I create an NSMutableArray called people and store them i

Let's say I create an object like this:

Person:
NSString *name;
NSString *phone;
NSString *address

I create several of these objects. Then I create an NSMutableArray called people and store them in there.

Can I save this array to disk wi开发者_Go百科th Array writeToFile? Does it need to be converted to NSData?


Any objects in your NSArray must be an NSString, NSDate, NSArray, NSDictionary, NSNumber or NSData for writeToFile to succeed.

Yes, you will need to archive each Person object to an NSData object before you put it into the array.

0

精彩评论

暂无评论...
验证码 换一张
取 消