0

I want to save all image's from my app with new album(with my app name). so I have use asserts library in my project. it is working good in ios 7 but not in ios8 and later one.With Mistake when user remove album from photos,assert library unable to create new album again with same name in ios8. Any one has solution for this? Thanks

user3418619
  • 235
  • 1
  • 2
  • 14
  • Go through this link.it may help you.http://stackoverflow.com/questions/26003211/assetslibrary-framework-broken-on-ios-8 –  Nov 24 '14 at 05:27
  • Yes it is working but I unable to understand full code. so when i am trying to save photo it created again one new album so can you give me one standard code? please I want to keep album name is photo app and thanks for replaying me – user3418619 Nov 25 '14 at 09:45

1 Answers1

-1

You can try My below Method for Create Album for iOS 7 and iOS 8

#define PHOTO_ALBUM_NAME @"AlbumName Videos"

#pragma mark - Create Album
-(void)createAlbum{

// PHPhotoLibrary_class will only be non-nil on iOS 8.x.x
Class PHPhotoLibrary_class = NSClassFromString(@"PHPhotoLibrary");

if (PHPhotoLibrary_class) {


    // iOS 8..x. . code that has to be called dynamically at runtime and will not link on iOS 7.x.x ...

    [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
        [PHAssetCollectionChangeRequest creationRequestForAssetCollectionWithTitle:PHOTO_ALBUM_NAME];
    } completionHandler:^(BOOL success, NSError *error) {
        if (!success) {
            NSLog(@"Error creating album: %@", error);
        }else{
            NSLog(@"Created");
        }
    }];
}else{
    [self.library addAssetsGroupAlbumWithName:PHOTO_ALBUM_NAME resultBlock:^(ALAssetsGroup *group) {
        NSLog(@"adding album:'Compressed Videos', success: %s", group.editable ? "YES" : "NO");

        if (group.editable == NO) {
        }

    } failureBlock:^(NSError *error) {
        NSLog(@"error adding album");
    }];
}}
Gaurav
  • 178
  • 12