iCloud sync of images in Photos Framework created album

て烟熏妆下的殇ゞ 提交于 2019-12-08 01:10:17

问题


TL;DR - Will an album created with [PHAssetCollectionChangeRequest creationRequestForAssetCollectionWithTitle:@"ALBUM_TITLE"]; sync over iCloud? And will synced images have the same localIdentifier on every device?

In my App I need to store a number of distinct albums/folders of photos that the user adds by either using the camera or adding an existing photo from the photo library. Ideally what I want is all the photos from the app to be located in the same one (specific to my app) album in the Photos app, for this album to sync over iCloud, and for me to be able to store references to the specific photos in this album so I can then resort these photos to the separate albums in my app.

I can create an album for the images, store the image's localIdentifier's in an array and use fetchAssetsWithLocalIdentifiers:options: to get the images.

The problem is getting these images to sync over iCloud. Will an album I create using [PHAssetCollectionChangeRequest creationRequestForAssetCollectionWithTitle:@"ALBUM_TITLE"]; sync over iCloud? From what I can tell, if the user doesn't have iCloud Photo Library enabled then it won't sync, but it will sync with iCloud Photo Library, is that correct?

If it will sync over iCloud, will the localIdentifier for the images in the album be the same, or will these get a new identifier when they download to a new device? If they do get new identifiers how can I store a reference to specific images that will persist across devices?


Note: I havn't got access to an iCloud enabled device to test this for now


回答1:


After testing it seems that any PHAssets created will sync over iCloud. (I've only tested this with iCloud Photo Library turned on so not 100% sure otherwise).

It also seems that the localIdentifier of PHAssets are exactly what they say: local, and won't persist across devices.



来源:https://stackoverflow.com/questions/34590338/icloud-sync-of-images-in-photos-framework-created-album

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!