1.plist 存储
1.利用沙盒根目录拼接“Documents”字符串
//存储
func saveArray()
{
// 1.获得沙盒根路径,不管是真机还是模拟机,用它是最合适不过了
let home:NSString =NSHomeDirectory()
print(home)
// 2.document路径
let docPath:NSString = home.stringByAppendingPathComponent("Documents")
// 3.新建数据
let data:NSArray = ["jack","ffff"]
//3.文件路径
let filepath:NSString = docPath.stringByAppendingPathComponent("data.plist")
//4.存储数据
data.writeToFile(filepathasString, atomically:true)
}
//读取
@IBActionfunc read() {
//1.获得沙盒根路径
let home:NSString =NSHomeDirectory()
//2.document路径
let doctPath:NSString = home.stringByAppendingPathComponent("Document")
//3.