1

I'm trying to run PhotosByLocation iOS example to familiarize myself with the assetsLibrary framework and noticed that I get a blank screen with "Albums" on top. The location services icon in the top right is showing, and I did give the app access to the device's photos and verified that the access exists.

I tested the project on two devices, and still cannot seem to get it to work.

I'm using xCode 4.6 and am building for iOS 6.1 . Has anyone else ran into an issue where PhotosByLocation gives you a blank black screen with "Albums" on top of it, but nothing else? How did you fix it?

I've narrowed the issue down to this block of code - no groups are added in the callback, and as a result when the table view reloads itself, it has no cells. I don't know why there are no groups added.

    ALAssetsLibraryGroupsEnumerationResultsBlock listGroupBlock = ^(ALAssetsGroup *group, BOOL *stop) {

        if (group) {
            [groups addObject:group];
        } else {
            // Add the favorites group if it has any elements
            if (!favoriteAssets) {
                favoriteAssets = [[FavoriteAssets alloc] init];
            }
            if ([favoriteAssets count] > 0) {
//no groups are added
                [groups addObject:favoriteAssets];
            }

            [self.tableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO];
        }
    };
Alex Stone
  • 46,408
  • 55
  • 231
  • 407

1 Answers1

0

Figured it out: the asset library was not looking for the camera roll. Adding ALAssetsGroupLibrary to code below shows camera roll in the list of available albums.

 NSUInteger groupTypes = ALAssetsGroupLibrary|ALAssetsGroupAlbum | ALAssetsGroupEvent;
    [assetsLibrary enumerateGroupsWithTypes:groupTypes usingBlock:listGroupBlock failureBlock:failureBlock];
Alex Stone
  • 46,408
  • 55
  • 231
  • 407