icloud Cloud Storage
1 Import UIKit2 3 classViewcontroller:uiviewcontroller {4 5 Overridefunc viewdidload () {6 super.viewdidload ()7 /**8 1: Two kinds of storage can be stored9 //ios documents that can be recognizedTen One //Dictionary object A */ - - //2:ubiquity Container ... and so on. Data region the - - /** - 3: + split into multiple file blocks - Proactive Request Synchronization + */ A at //Get Data -var Icouldstore =Nsubiquitouskeyvaluestore.defaultstore () - icouldstore.synchronize () - - - //Read inIcouldstore.stringforkey ("name") -Icouldstore.stringforkey (" Area") to +println"name: \ (name)") -println"Area : \ (area)") the * $ Panax Notoginseng //Write Data -var Icouldstore =Nsubiquitouskeyvaluestore.defaultstore () the icouldstore.synchronize () + AIcouldstore.setstring (CompanyName, Forkey:"name") theIcouldstore.setstring (Companyarea, Forkey:" Area") + - $ } $ - Overridefunc didreceivememorywarning () { - super.didreceivememorywarning () the - Wuyi } the - Wu}
iOS development-Data Persistence Swift Chapter &icloud cloud storage