Hi,
I'd like to find out the local identifier of an asset so that I can do something about it from my app extension through my container app.
Basically, I can get the URL frm the NSItem provider but this url starts with something like:
file:///var/mobile/Media/PhotoData/OutgoingTemp/14565673-FE65-4184-BC97-A9D4A112472F.JPG
but when I enumerate the PHAssets using the following
PHFetchOptions *option = [PHFetchOptions new];
option.includeHiddenAssets = YES;
PHFetchResult *allAssets = [PHAsset fetchAssetsWithOptions:option];
[allAssets enumerateObjectsUsingBlock:^(PHAsset *asset, NSUInteger idx, BOOL *stop) {
[[Defaults defaultPHImageManager] requestImageDataForAsset:asset options:imageRequestOptions resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) {
DBG(@"File URL = %@", info[@"PHImageFileURLKey"]);
}];
}
The URLs I'm getting doesn't match the url from the app extension and they start with something like:
file:///var/mobile/Media/DCIM/100APPLE/IMG_0012.JPG
How do I load a PHAsset from the app etension and pass the local identifier to my app?