现需功能:选择的本地相册照片上传,如果上传过程中中断。下次开启程序可以继续上传任务。
遇到问题:选择的本地照片数据PHAsset不遵守NSCoding协议,无法归档。寻求本地保存的方案。或者此功能更好的解决方案。
感谢!
PHP中文网2017-04-18 09:19:03
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
ringa_lee2017-04-18 09:19:03
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.
黄舟2017-04-18 09:19:03
Owner, I also encountered the same problem, please tell me how to solve it.