swift Swift - CloudKit - 图像和大文件(资产)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了swift Swift - CloudKit - 图像和大文件(资产)相关的知识,希望对你有一定的参考价值。

In addition to data, CloudKit may also be used to store larger assets such as audio or video 
files, large documents, binary data files or images. These assets are stored within CKAsset 
instances. Assets can only be stored as part of a record and it is not possible to directly 
store an asset in a cloud database. Once created, an asset is added to a record as just 
another key-value field pair. The following code, for example, demonstrates the addition 
of an image asset to a record:

let imageAsset = CKAsset(fileURL: imageURL)

let myRecord = CKRecord(recordType: "Vacations")

myRecord.setObject("London" as CKRecordValue?, forKey: "city")
myRecord.setObject(imageAsset as CKRecordValue?, forKey: "photo")

以上是关于swift Swift - CloudKit - 图像和大文件(资产)的主要内容,如果未能解决你的问题,请参考以下文章

swift Swift - CloudKit - 获取用户ID

swift Swift - CloudKit - 推送通知

swift Swift - CloudKit共享

swift Swift - CloudKit - 维护本地缓存

swift Swift - CloudKit - 部署架构

swift Swift - CloudKit订阅 - 5