Skip to content

Instantly share code, notes, and snippets.

@laiso
Created March 1, 2012 20:11
Show Gist options
  • Save laiso/1952799 to your computer and use it in GitHub Desktop.
Save laiso/1952799 to your computer and use it in GitHub Desktop.
iOS フォトアルバムデータの取得
//
// AppDelegate.m
// PhotoLibraryAccess
#import "AppDelegate.h"
#import <AssetsLibrary/AssetsLibrary.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
ALAssetsLibrary* library = [[ALAssetsLibrary alloc] init];
[library enumerateGroupsWithTypes:ALAssetsGroupAll
usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
[self loadGroup:group];
} failureBlock:^(NSError *error) {
;
}];
return YES;
}
- (void)loadGroup:(ALAssetsGroup *)group
{
[group enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) {
ALAssetRepresentation* representation = [result defaultRepresentation];
UIImage* image = [UIImage imageWithCGImage:[representation fullScreenImage]];
NSLog(@"%@", image);
}];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment