Created
March 1, 2012 20:11
-
-
Save laiso/1952799 to your computer and use it in GitHub Desktop.
iOS フォトアルバムデータの取得
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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