https://stackoverflow.com/questions/35479903/swift-download-a-video-from-distant-url-and-save-it-in-an-photo-album

[BFModule(TransitionModuleService) presentLoading];
    dispatch_async(dispatch_get_global_queue(0, 0), ^{
        NSURL *videoUrl = [NSURL URLWithString:video];
        NSData *videoData = [NSData dataWithContentsOfURL:videoUrl options:NSDataReadingMapped error:nil];
        NSString *documentPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];
        NSString *tmpPath = [NSString stringWithFormat:@"%@/tempFile.mp4", documentPath];
        dispatch_async_on_main_queue(^{
            [videoData writeToFile:tmpPath atomically:YES];
            [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
                [PHAssetChangeRequest creationRequestForAssetFromVideoAtFileURL:[NSURL URLWithString:tmpPath]];
            } completionHandler:^(BOOL success, NSError * _Nullable error) {
                dispatch_async_on_main_queue(^{
                    [BFModule(TransitionModuleService) dismissLoading];
                    if (success) {
                        [BFModule(LMAlertToastModuleService) showToastWithTitle:@"提示" message:@"保存成功"];
                    }
                });

            }];
        });
    });

1 Comments latest

  • frandon

    Unrefined olive oils with more than 3 <a href=http://lasix.beauty>lasix diuretic side effects</a>