保存到.plist属性列表
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了保存到.plist属性列表相关的知识,希望对你有一定的参考价值。
//What you want to do is write it into your sandbox Documents directory like so:
NSArray *paths
= NSSearchPathForDirectoriesInDomains
(NSDocumentDirectory, NSUserDomainMask,
YES);
NSString *documentsDirectory
= [paths objectAtIndex
:0];
NSString *path
= [documentsDirectory stringByAppendingPathComponent
:@"patientList.plist"];
[myPatients writeToFile:path atomically:YES];
//or write it into your sandbox temporary (/tmp) directory like this
NSString *path
= [NSTemporaryDirectory
() stringByAppendingPathComponent
:@"patientList.plist"];
[myPatients writeToFile:path atomically:YES];
Reading it:
NSArray *paths
= NSSearchPathForDirectoriesInDomains
(NSDocumentDirectory, NSUserDomainMask,
YES);
NSString *documentsDirectory
= [paths objectAtIndex
:0];
NSString *path
= [documentsDirectory stringByAppendingPathComponent
:@"patientList.plist"];
contentArray
= [NSArray arrayWithContentsOfFile
:path
];
以上是关于保存到.plist属性列表的主要内容,如果未能解决你的问题,请参考以下文章
iOS数据持久化之---属性列表
SWIFT 属性列表:从 TableView 到 DetailView plist
动态创建 Plist 文件
请帮助理解保存数据。核心数据与 plist
“InfoDictionary 版本”在信息属性列表(plist 文件)中表示啥?
“InfoDictionary 版本”在信息属性列表(plist 文件)中表示啥?