我什么时候可以使用Photos Framework和iCloud Photo Library? [英] When can I use Photos Framework and iCloud Photo Library?

查看:230
本文介绍了我什么时候可以使用Photos Framework和iCloud Photo Library?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为我的用户提供一个照片选择器,它与照片应用程序类似地显示所有图像。目前我可以使用两个框架,旧资产库和新的照片库框架。有什么建议我应该如何在这两者之间做出选择?

I want to provide my users a photo picker which displays all their images similarly to the Photos app. Currently I can use two frameworks, the old Assets Library and the new Photos Library frameworks. Is there any recommendation how should I choose between these two?

文件说明:


在iOS 8.0及更高版本中,使用Photos框架而不是Assets Library框架。 Photos框架为使用用户的照片库提供了更多功能和更好的性能。

In iOS 8.0 and later, use the Photos framework instead of the Assets Library framework. The Photos framework provides more features and better performance for working with a user’s photo library.

但是正如我的测试显示的那样,有些情况当用户尚未启用iCloud Photo Library时,我可以通过新框架检索他们的照片。如何检测是否启用了iCloud Photo Library?如果启用,旧框架或多或少仍然有效,但似乎并不显示每张照片。它显示哪些照片?我要继续使用它吗?我找不到任何关于此的文档。

But as my tests show, there are some cases when the user has not yet been enabled iCloud Photo Library, thus I can retrieve none of their photos via the new framework. How can I detect if iCloud Photo Library is enabled? And if enabled, the old framework more or less still works, but it seems that does not show every photo. Which photos does it show? Shall I continue using it? I can't find any documentation about this.

推荐答案

我用Assets Library框架创建了一个应用程序,我正在测试另一个使用Photos框架。

在我的iPhone上我没有启用iCloud Photo Library,但是使用这两个框架我可以检索所有照片。
另一方面,在我的iPad上,我使用优化[设备]存储选项启用了iCloud Photo Library。在这种情况下( https://support.apple.com/en-us/HT204264 ):

I've made an app with Assets Library framework and I'm testing another one with Photos framework.
On my iPhone I haven't enabled iCloud Photo Library, but with both frameworks I can retrieve all the photos. On the other hand, on my iPad I've enabled iCloud Photo Library with "Optimize [device] Storage" option. In this case (https://support.apple.com/en-us/HT204264):


所有原始的全分辨率照片和视频都存储在iCloud中,同时设备大小版本保留在您的设备上。您可以在需要时通过Wi-Fi或手机下载原始照片和视频。

All of your original, full-resolution photos and videos are stored in iCloud while device-size versions are kept on your device. You can download the original photos and videos over Wi-Fi or cellular when you need them.

在iPad上,使用Photos框架我可以检索所有照片,而使用资产库的旧应用程序我只能找到已下载的照片(即我使用照片框架向应用程序请求的图像)。

On iPad, with the Photos framework I can retrieve all photos, while with the old app using Assets Library I find only the downloaded ones (i.e. the images I've requested with the app using Photos framework).

我认为如果您选择其他选项:下载并保留原件两个框架都可以检索所有照片(但我还没有尝试过)。

I think that if you select the other option: "Download and Keep Originals" both frameworks can retrieve all photos (but I haven't tried yet).

我希望这可以提供帮助。

I hope this can help.

这篇关于我什么时候可以使用Photos Framework和iCloud Photo Library?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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