0

I am trying to save a MOV file to the Camera Roll that is stored in the Documents directory of my application. In iOS 7, I would use ALAssetsLibrary like so to export my video:

  NSString *URL = [NSHomeDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"Documents/%@.mov", _recFinalName]];
  NSURL *fileURL = [NSURL fileURLWithPath:URL];
  ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
    [library writeVideoAtPathToSavedPhotosAlbum:fileURL
                                completionBlock:^(NSURL *assetURL, NSError *error) {}];

However, this method does not work on iOS 8. I know that you must use the photos framework. But I am lost as to how to actually use it to save my video file. I was not able to find any information on this topic.

UPDATE (1/22/15)

I did test my original method on another iOS 8 device earlier today on an iPhone 5. I am running iOS 8.2 beta 4 on an iPhone 6. So it must have something to do with the hardware or software.

anthonya1999
  • 253
  • 3
  • 13
  • code is fine and will work in iOS 8. the problem you may have is that you do not have permission to write to camera roll go under setting and grant your app access – Sam B Jan 22 '15 at 00:34
  • @SamB I have indeed done this. It still does not work. It looks like this person is experiencing a similar problem. http://stackoverflow.com/questions/26065774/which-phassetcollection-to-use-for-saving-an-image – anthonya1999 Jan 22 '15 at 00:42

2 Answers2

1

It's nearly as simple is that some devices require it to be in a MP4 format, and it simply won’t save in a MOV. Change the output file type or change it after its saved to MP4. Saving to camera roll should now work!

Pyrology
  • 169
  • 2
  • 12
0

You can try this

if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum (filePath))
{
   UISaveVideoAtPathToSavedPhotosAlbum (filePath,self,@selector(video:didFinishSavingWithError:contextInfo:), nil);
}

where The filePath is the path to the movie file you want to save to the Camera Roll. Go through apple docs for further help.

thanks.

Saif
  • 2,678
  • 2
  • 22
  • 38
  • Unfortunately, this does not work either. If it helps, I did test my original method on another iOS 8 device earlier today on an iPhone 5. I am running iOS 8.2 beta 4 on an iPhone 6. So it must have something to do with the hardware or software. – anthonya1999 Jan 22 '15 at 19:17