我曾尝试使用以下API,但如下所示出现此错误
错误域= NSCocoaErrorDomain代码= -1"(null)"
- (PHAssetResourceDataRequestID)requestDataForAssetResource:(PHAssetResource *)resource
options:(nullable PHAssetResourceRequestOptions *)options
dataReceivedHandler:(void (^)(NSData *data))handler
completionHandler:(void(^)(NSError *__nullable error))completionHandler;
以下是示例实现
NSArray *assetResourcesArray = [PHAssetResource assetResourcesForAsset: myPhAssetObject];
PHAssetResource *assetResource = [assetResourcesArray objectAtIndex:0];
[[PHAssetResourceManager defaultManager] requestDataForAssetResource:assetResource options:nil dataReceivedHandler:^(NSData * _Nonnull data) {
//do something with video data
NSLog(@"data %lu", [data length]);
}
completionHandler:^(NSError * _Nullable error) {
NSLog(@"error ======== %@", error);
}];
任何正确方向的暗示都将受到高度赞赏。