3

I'm saving a video to my PhotosAlbum, using this code:

    ALAssetsLibrary *assetLibrary = [[ALAssetsLibrary alloc] init];
    [assetLibrary writeVideoAtPathToSavedPhotosAlbum:[NSURL URLWithString:videoPath] completionBlock:^(NSURL *assetURL, NSError *error)
    {
         NSError *removeError = nil;
         [[NSFileManager defaultManager] removeItemAtURL:[NSURL URLWithString:videoPath] error:&removeError];
    });

The video goes to the folder Videos but i want it to go to a specific folder with the name of the app. How can i accomplish this?

bruno
  • 2,154
  • 5
  • 39
  • 64

1 Answers1

0

like this

 ALAssetsLibrary* assetLibrary = [[ALAssetsLibrary alloc] init];
 [assetLibrary writeVideoAtPathToSavedPhotosAlbum:[NSURL URLWithString:@""] completionBlock:^(NSURL *assetURL, NSError *error) {
    [assetLibrary addAssetURL:[NSURL URLWithString:@""]  toAlbum:@"" completion:^(NSURL *assetURL, NSError *error) {
    NSError* removeError = nil;
        [[NSFileManager defaultManager] removeItemAtURL:[NSURL URLWithString:@""] error:&removeError];
    } failure:^(NSError *error) {
        NSLog(@"%@", error);
    }];
}];
bruno
  • 2,154
  • 5
  • 39
  • 64
falcon143
  • 702
  • 4
  • 19
  • try this http://stackoverflow.com/questions/10721988/save-video-to-custom-album-in-camera-roll?rq=1 – falcon143 Aug 07 '14 at 10:44
  • Your pathUrl just comes out of nowhere, it's a bit incomplete. Seems like copied from somewhere and dumped here. – bruno Aug 07 '14 at 11:06
  • let me ask one question, which one is dumbed above code or URL – falcon143 Aug 07 '14 at 11:14
  • no one is answer for this question but i try to answer for ur question u said i dumbed code from some where, currently working on record video with animation and save it to local and also in photoalbum folder – falcon143 Aug 07 '14 at 11:20
  • I'm doing the same thing but i want to save to a specific folder in photo album. For example [self addAssetURL...] does not exists, [assetLibrary addAssetURL...] is the correct code. – bruno Aug 07 '14 at 11:23
  • try this link will help you http://stackoverflow.com/questions/17569505/saving-video-in-an-album-created – falcon143 Aug 07 '14 at 11:27
  • Change the code in the comment above ande replace pathUrl with assetURL and i will accept your answer. – bruno Aug 07 '14 at 11:31
  • [self addAssetURL...] does not exists, change it to [assetLibrary addAssetURL...] like i already said. – bruno Aug 07 '14 at 11:34
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/58872/discussion-between-ramesh-kumar-and-bruno). – falcon143 Aug 07 '14 at 11:37