rFlex / SCRecorder

iOS camera engine with Vine-like tap to record, animatable filters, slow motion, segments editing
Apache License 2.0
3.06k stars 583 forks source link

Can't export to Camera roll #318

Open mavencode01 opened 8 years ago

mavencode01 commented 8 years ago

I can't export the video to the Camera roll.

Seems the output url is not pointing to the right merge file url.

[exportSession.outputUrl saveToCameraRollWithCompletion:^(NSString * _Nullable path, NSError * _Nullable error) {

                [[UIApplication sharedApplication] endIgnoringInteractionEvents];

                if (error == nil) {
                    [[[UIAlertView alloc] initWithTitle:@"Saved to camera roll" message:@"" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show];
                } else {
                    [[[UIAlertView alloc] initWithTitle:@"Failed to save" message:error.localizedDescription delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show];
                }
            }];
mavencode01 commented 8 years ago

Weird thing is that it works in the example project.

baseljd commented 8 years ago

I had a similar issue, I was getting "Data Unavailable" error. Maybe the app permission for accessing the camera roll was disabled. I enabled it and everything worked fine.

SimpleDS commented 5 years ago

In case anyone else is having this issue today, I would suggest using the PHPhotoLibrary to handling this use case.

- (void) saveToCameraRoll:(NSURL *)outputURL
{

    [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
        PHAssetChangeRequest *changeRequest = [PHAssetChangeRequest creationRequestForAssetFromVideoAtFileURL:outputURL];
     } 
     completionHandler:^(BOOL success, NSError *error) {
        if (success) {
            NSLog(@"save done");
        } 
        else {
            NSLog(@"something went wrong %@", error.localizedDescription);
        }
    }];    
}