pna*_*avk 0 ios xamarin ios8 photokit
反正我是否可以使用从中返回的路径"PHImageFileURLKey"进入照片库并检索图像?
返回的路径采用以下格式:
"file:///var/mobile/Media/DCIM/102APPLE/IMG_2607.JPG"
Run Code Online (Sandbox Code Playgroud)
我的计划是将此路径存储在数据库中,并在需要将其恢复时使用它来获取图像.
任何帮助表示赞赏.谢谢!
我认为您从URL检索Photo Kit资产的解决方案是错误的.
这是我要做的(假设你有权访问PHAsset):
存储localIdentifier:
PHAsset *asset = /*Your asset */
NSString *localIdentifier = asset.localIdentifier;
//Now save this local identifier, or an array of them
Run Code Online (Sandbox Code Playgroud)
当需要检索它们时,您只需执行以下操作:
PHFetchResult *savedAssets = [PHAsset fetchAssetsWithLocalIdentifiers:savedLocalIdentifiers options:nil];
[savedAssets enumerateObjectsUsingBlock:^(PHAsset *asset, NSUInteger idx, BOOL *stop) {
//this gets called for every asset from its localIdentifier you saved
}];
Run Code Online (Sandbox Code Playgroud)
如果您只能访问"PHImageFileURLKey",则忽略此答案.
| 归档时间: |
|
| 查看次数: |
8321 次 |
| 最近记录: |