ios - 如何获取共享照片流 ALAsset 的 ALAssetRepresentation?

标签 ios objective-c alasset photostream

当我尝试访问照片流中的图片时,有时 [asset defaultRepresentation] 方法返回 nil。

根据文档,如果 Assets 在本地(尚)不可用,则可能会发生这种情况。

This method returns nil for assets from a shared photo stream that are not yet available locally. If the asset becomes available in the future, an ALAssetsLibraryChangedNotification notification is posted.

一旦我在 Photos.app 中查看照片,它也可用于我的应用程序,但显然我想让我的应用程序触发“本地下载”事件。

我查看了 MyImagePicker来自 Apple 的示例代码,但它表现出相同的行为(只有缩略图可用)

如何使 Assets 在本地可用?

编辑:由于 Apple 推出了 Photos.framework在 iOS8 中,并且在 iOS9 中不推荐使用 ALAssets,这可能永远不会被修复。

最佳答案

我遇到了同样的问题。我找不到实际获取图像的方法。 您所能做的就是不显示“defaultRepresentation”为零的图像,或者通过调用 [ALAssetsLibrary disableSharedPhotoStreamsSupport];

完全放弃对共享照片的支持

希望对你有帮助

关于ios - 如何获取共享照片流 ALAsset 的 ALAssetRepresentation?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18079776/

相关文章:

ios8 - 如何从PHAsset获取ALAsset URL?

ios - Swift 中的约束不起作用

ios - 升级到 iOS8 后,UITableView didSelectRowAtIndexPath 不工作

ios - 这是淡入和淡出 UIView 的正确方法吗?

iphone - 带有简单动画的 iOS UIViewController

iphone - 将元数据写入 ALAsset

ios - 保存到服务器后如何在 iOS 中正确获取正确的视频方向

ios - iOS5 上的 FBConnect 和 ARC

iOS:启动具有多个收件人的消息应用程序

ios - Sprite Kit - Objective c,同时移动多个SKNode