How to Save NSMutableArray into plist in iphone

后端 未结 4 1777
执笔经年
执笔经年 2020-12-10 18:42

I am new in iphone, i want to save NSMutableArray data into plist file my Code is:

NSArray *array = [[NSArray alloc] initWithArray:self.artistDetailsArray];
         


        
4条回答
  •  北海茫月
    2020-12-10 19:21

    You can use property lists (NSPropertyListSerialization or writeToFile: way). But be sure your array contains valid property list objects only (NSString, NSNumber, NSData, NSArray, or NSDictionary objects) and NSDictionary has only NSString keys. Custom (complex) objects have to be represented as dictionaries.

    Or you should use approach with archives http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/Archiving/Archiving.html through NSCoding protocol. Nice guide is here http://cocoadevcentral.com/articles/000084.php

提交回复
热议问题