iOS: Store new photos using UIImagePickerController NOT in default album

1.2k views Asked by At

I am using UIImageWriteToSavedPhotosAlbum to store a new photo on the iPhone (code see below).

UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil);

This works fine. However I would like to store new photos in a different album. Not the default one.

EDIT

I am using the following block to create the album.

ALAssetsLibraryGroupResultBlock resultblock = ^(ALAssetsGroup *assetGroup)
    {
        [assetGroup addAsset:myasset]
    };

ALAssetsLibraryAccessFailureBlock failureblock = ^(NSError *myerror)
{
    NSLog(@"in failureblock, got an error: %@",[myerror localizedDescription]);
};
[library addAssetsGroupAlbumWithName:name resultBlock:resultblock failureBlock:failureblock];`

I am using the UIImagePickerController. How do I get the asset of a new image? When/where do I call UIImageWriteToSavedPhotosAlbum to store it?

1

There are 1 answers

1
cweinberger On BEST ANSWER

Since iOS 5 you can create a new album with addAssetsGroupAlbumWithName:resultBlock:failureBlock: using the ALAssetsLibrary