Saving a Video to the Photo Library - iPhone SDK

后端 未结 3 1545
情深已故
情深已故 2020-12-18 08:31

Is there any way for me to save a video in the Documents directory to the Photos Library? I have the link of the video in the documents directory, I just don\'t know how to

3条回答
  •  爱一瞬间的悲伤
    2020-12-18 09:27

    If you are saving it in a local directory first, then you can save it as..

        ALAssetsLibrary *assetLibrary = [[ALAssetsLibrary alloc] init];
        [assetLibrary writeVideoAtPathToSavedPhotosAlbum:url completionBlock:^(NSURL *assetURL, NSError *error){
            if(error) {
               NSLog(@"error while saving to camera roll %@",[error localizedDescription]);        
            } else {
                //For removing the back up copy from the documents directory           
                NSError *removeError = nil;
                [[NSFileManager defaultManager] removeItemAtURL:url error:&removeError];
                NSLog(@"%@",[removeError localizedDescription]);
            }
        }];
    

提交回复
热议问题