照片框架创建的相册中的图像的iCloud同步 [英] iCloud sync of images in Photos Framework created album

查看:194
本文介绍了照片框架创建的相册中的图像的iCloud同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

TL; DR-使用 [PHAssetCollectionChangeRequest creationRequestForAssetCollectionWithTitle:@"ALBUM_TITLE"]; 创建的相册是否可以通过iCloud同步?并在每台设备上同步的图像都具有相同的 localIdentifier 吗?

在我的App中,我需要存储用户通过使用相机或从照片库添加现有照片而添加的许多不同的相册/照片文件夹.理想情况下,我想要的是应用程序中的所有照片都位于照片应用程序中的同一张(特定于我的应用程序)相册中,以便该相册可以通过iCloud进行同步,并且我可以存储对特定相册的引用相册中的照片,因此我可以将这些照片重新放入应用程序中的单独相册.

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.

我可以为图像创建相册,将图像的localIdentifier存储在数组中,然后使用fetchAssetsWithLocalIdentifiers:options:来获取图像.

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.

问题是使这些图像通过iCloud进行同步.我使用[PHAssetCollectionChangeRequest creationRequestForAssetCollectionWithTitle:@"ALBUM_TITLE"];创建的相册会在iCloud上同步吗?据我所知,如果用户未启用iCloud照片库,则它不会同步,但会与iCloud照片库同步,对吗?

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?

如果它将通过iCloud同步,相册中图像的localIdentifier是否相同,或者当这些图像下载到新设备时会获得新的标识符吗?如果它们确实获得了新的标识符,我该如何存储对将在设备之间保留的特定图像的引用?

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?

注意:我暂时无法访问支持iCloud的设备对此进行测试

推荐答案

经过测试,似乎所有创建的PHAsset都会在iCloud上同步. (我仅在打开iCloud照片库的情况下对此进行了测试,因此不能100%地确定是否为其他方式).

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).

PHAsset的localIdentifier似乎也正是他们所说的:本地的,不会在设备之间持久存在.

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

这篇关于照片框架创建的相册中的图像的iCloud同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆