so i'm new making Share Extension, today im continue my project by creating Share Extension Video, but stuck after getting return data type NSURL (video Path file), in my method only accept PHAsset.
so my code like this
[itemProvider loadItemForTypeIdentifier:UTTypeVideo
options:nil
completionHandler:^(NSURL *videoURL, NSError *error) {
NSURL *url = videoURL;
PHFetchResult *fetchResult = [PHAsset fetchAssetsWithALAssetURLs:@[url] options:nil];
PHAsset *asset = [fetchResult firstObject]; //always return nil
AVAsset *videoAsset = [AVAsset assetWithURL:videoURL];
getting stuck here-> [[ChatMessenger sharedManager] sendVideoMessageWithAsset:asset
caption:captionString
room:roomData
start:^(MessageModel * _Nonnull message) {
NSLog(@"======START");
} progress:^(CGFloat progress, CGFloat total) {
NSLog(@"======PROGRESS %f TO %f", progress, total);
} success:^(MessageModel *message) {
NSLog(@"======SUCCESS");
**strong text** [self finishSharedItemRequestReturningItems];
} failure:^(NSError *error) {
NSLog(@"======FAILED");
}];
is there any hint for doing from NSURL - video Share Extension to PHAsset ?