How to store big image in CloudKit?

感情迁移 提交于 2019-12-05 09:17:53

You should store pictures as a CKAsset. For a CKRecord there is a size limitation. For a CKAsset there is not (beside the CloudKit storage limitations). According to the documentation:

Use assets for discrete data files. When you want to associate images or other discrete files with a record, use a CKAsset object to do so. The total size of a record’s data is limited to 1 MB though assets do not count against that limit.

You can create a CKAsset like this:

var File : CKAsset = CKAsset(fileURL: NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("image-not-available", ofType: "jpg")!))
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!