标签:
iCloud云存储
1 import UIKit 2 3 class ViewController: UIViewController { 4 5 override func viewDidLoad() { 6 super.viewDidLoad() 7 /** 8 1:可以存储两种 9 //IOS可识别的文档 10 11 //字典对象 12 */ 13 14 // 2: Ubiquity Container............数据区域 15 16 17 /** 18 3: 19 分成多个文件小块 20 主动请求同步 21 */ 22 23 //获取数据 24 var iCouldStore = NSUbiquitousKeyValueStore.defaultStore() 25 iCouldStore.synchronize() 26 27 28 //读取 29 iCouldStore.stringForKey("name") 30 iCouldStore.stringForKey("area") 31 32 println("name: \(name)") 33 println("area: \(area)") 34 35 36 37 //写数据 38 var iCouldStore = NSUbiquitousKeyValueStore.defaultStore() 39 iCouldStore.synchronize() 40 41 iCouldStore.setString(companyName, forKey: "name") 42 iCouldStore.setString(companyArea, forKey: "area") 43 44 45 } 46 47 override func didReceiveMemoryWarning() { 48 super.didReceiveMemoryWarning() 49 50 51 } 52 53 54 }
标签:
原文地址:http://www.cnblogs.com/iCocos/p/4598785.html