I\'m trying to create a custom album in the Photo Library of an iPhone and then save photos that I\'ve taken with the camera, or chosen from the phones Camera Roll to that c
Fernando's answer worked for me in iOS 7.
Steps :
1) Download the ALAssetsLibrary+CustomPhotoAlbum code from here: http://www.touch-code-magazine.com/wp-content/uploads/2011/11/ALAssetsLibrary_CustomPhotoAlbum.zip?a071b6 and copy the 2 files for the category inside your Xcode project.
2)In your header file,add the following lines
#import
#import "ALAssetsLibrary+CustomPhotoAlbum.h"
@property (strong, atomic) ALAssetsLibrary* library;
3) In your implementation file,add the following lines
@synthesize library=_library;
EDIT: 4) initialise the asset library instance, preferably in "viewDidLoad" method, otherwise the saveImage method below won't execute. (CONFIRMED):
[I am resubmitting the suggested edit because someone with non-iphone skills rejected the previous submission. This is undoubtedly a great answer by @santhu & Fernando and helped me a lot, however, the initialisation piece of code was missing so it took me a bit of time to figure out why the code didn't work. Hence, I would appreciate if a moderator with iPhone development skillset reviews the edit.]
_library = [[ALAssetsLibrary alloc] init];
5) Add this in the method where you wish to save
//Add this in the method where you wish to save
[self.library saveImage:(UIImage *) toAlbum:(NSString *) withCompletionBlock:^(NSError *error) {
if (error!=nil) {
NSLog(@"Big error: %@", [error description]);
}
}];