0

I am using UIActivityViewController to save a bunch of video assets to user's camera roll, but the problem is there is no way to know whether the save to photo library was successful or not, and also get error code if it was unsuccessful. Is there any way to override the default behavior of builtin activity? I see that the completionHandler of UIActivityViewController is pretty useless in this regard.

Deepak Sharma
  • 5,577
  • 7
  • 55
  • 131

1 Answers1

0

Use the completionBlock to do.

ALAssetsLibrary *lib = [[[ALAssetsLibrary alloc] init] autorelease];
if ([lib videoAtPathIsCompatibleWithSavedPhotosAlbum:videoURL]) {
   [lib writeVideoAtPathToSavedPhotosAlbum:videoURL
      completionBlock:^(NSURL *assetURL, NSError *error) {

      if (!error) 
      {
         [self performSelectorOnMainThread: @selector(dismissAlertView) withObject: nil, waitUntilDone:NO];
      }
  }];
}

- (void)dismissAlertView
{
   //dismiss your alertview here.
}
Shamsudheen TK
  • 30,739
  • 9
  • 69
  • 102