ios - 如何使用 fetchAssetsWithALAssetURLs 获取 PHAsset

标签 ios alassetslibrary phasset

我尝试了很多方法来获取照片和视频的相册,都没有达到我的要求。首先,我有一个显示照片和视频的页面列表,我已经实现了,我在这里保存照片的路径。但是当我用fetchAssetsWithALAssetURLs取值的时候,一直报错。我试着用

path = assets-library://asset/asset.JPG?id=4BA5B72F-0F65-47B0-B42C-8E1C982AD840&ext=JPG 或 path = file:///var/mobile/Media/DCIM/101APPLE/IMG_1204.JPG 或 path = 4BA5B72F-0F65-47B0-B42C-8E1C982AD840/L0/001 全部错误

[__NSCFString scheme]: unrecognized selector sent to instance 0x170095810
2014-11-18 15:15:52.017 MiHuaTV[5769:1789591] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString scheme]: unrecognized selector sent to instance 0x170095810'

首先抛出调用栈:

(0x188169e48 0x19885c0e4 0x188170f14 0x18816dcc4 0x188072c1c 0x192e4e358 0x18bfae134 0x18bfb9efc 0x18bfadfc8 0x10005107c 0x18bf97144 0x1003a0e30 0x1003a0df0 0x1003a575c 0x1881216a0 0x18811f748 0x18804d1f4 0x1911e35a4 0x18c97e784 0x100107f84 0x198ecaa08)
libc++abi.dylib: terminating with uncaught exception of type NSException

如何使用 fetchAssetsWithALAssetURLs

最佳答案

您似乎将 NSString 对象作为参数传递给 fetchAssetsWithALAssetURLs。您需要传递 NSURL。

关于ios - 如何使用 fetchAssetsWithALAssetURLs 获取 PHAsset,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26988700/

相关文章:

ios - 在iOS上使用OpenGL-ES 2.0设置横向投影的正确方法是什么?

android - IOS 中的 onSaveInstanceState 是什么?

ios - PHAsset:什么是 'assetSource' ?

swift - 更改请求完成后如何从 PHObjectPlaceholder 获取新创建的对象

ios - 如何在 IBAction 中请求通知权限?

ios - 多点连接 : Invalid service type

swift - 如何快速将电影保存到自定义命名的相册

iphone - 无法从异步 block 向主线程发送参数

xcode - 如何在 Swift 中初始化 ALAssetsGroupType 常量?

ios - 如何使用照片框架从iOS相机胶卷中获取最新的照片?