objective-c - iOS PHAsset对象如何本地保存
阿神
阿神 2017-04-18 09:17:03
0
3
535

现需功能:选择的本地相册照片上传,如果上传过程中中断。下次开启程序可以继续上传任务。
遇到问题:选择的本地照片数据PHAsset不遵守NSCoding协议,无法归档。寻求本地保存的方案。或者此功能更好的解决方案。
感谢!

阿神
阿神

闭关修行中......

reply all(3)
Ty80

If you can’t save it directly, just find a mark and record it. Next time, use this mark to filter and get the original object.
So I looked for the documentation and there happened to be something like this:

  • (PHFetchResult<PHAsset > )fetchAssetsWithLocalIdentifiers:(NSArray<NSString > )identifiers options:(nullable PHFetchOptions *)options;

identifiers just pass the localIdentifier of PHAsset:
@property (nonatomic, copy, readonly) NSString *localIdentifier;

Save the localIdentifier and use this to filter next time you open it

左手右手慢动作

To prevent the picture from being deleted, the best solution is to move it to the app’s file directory. Just remove it after uploading.

黄舟

Owner, I also encountered the same problem, please tell me how to solve it.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template