SCRecorder icon indicating copy to clipboard operation
SCRecorder copied to clipboard

Can't export to Camera roll

Open mavencode01 opened this issue 9 years ago • 3 comments

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 avatar Jun 09 '16 16:06 mavencode01

Weird thing is that it works in the example project.

mavencode01 avatar Jun 09 '16 16:06 mavencode01

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.

baseljd avatar Jun 15 '16 09:06 baseljd

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);
        }
    }];    
}

SimpleDS avatar Nov 07 '18 23:11 SimpleDS