iCloud + UIDocument

iCloud很显然,你可以将一些文件同步到iCloud之上,可以有几种同步数据类型,支持比较好的就是UIDocument

iCloud的三种存储方式 Key-Value, Documents, Core Data都是在之前已有的框架上进行扩展的高级接口。

iCloud + Key-Value对应的基础是NSUserDefaults。 

iCloud + Documents对应的基础是使用文档进行数据存储(NSFileManager,NSFileCoordinator,NSFileWrapper,NSCoding等一系列持久化数据存储到文件的问题).

iCloud + Core Data的对应基础就是Core Data。



1.NSFileManager

iOS文件系统

https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/index.html

一些栗子

http://liwpk.blog.163.com/blog/static/36326170201158229415/

2.UIDocument

https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIDocument_Class/index.html

它帮你处理好write,read等基本操作,使得你从一些反复底层解脱出来

http://blog.csdn.net/samrtian/article/details/12883815

3.NSFileCoordinator

https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSFileCoordinator_class/index.html

4.NSFileWrapper

5.NSCoding

6.NSFileVersion

最后,多个终端(touch,pad或者iphone)同时处理文件时候,一定会产生冲突,这时候就需要使用NSFileVersion解决冲突问题

https://developer.apple.com/library/mac/documentation/Foundation/Reference/NSFileVersion_Class/index.html


app文件目录结构



http://www.raywenderlich.com/12779/icloud-and-uidocument-beyond-the-basics-part-1

http://www.raywenderlich.com/12794/icloud-and-uidocument-beyond-the-basics-part-2

http://www.raywenderlich.com/12816/icloud-and-uidocument-beyond-the-basics-part-3

http://www.raywenderlich.com/12837/icloud-and-uidocument-beyond-the-basics-part-4

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值