Skip to content

morishin/AssetsAccessor

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

!OBSOLETE! AssetsAccessor

A Class for accessing Assets (photos and videos) in iOS device using the Assets Library Framework.

Here is the post about this (Japanese).

Methods

AssetsAccessor Class has the following methods.

- (void)getAssetByURL:(NSURL *)assetURL;
- (void)getAssetsByURLs:(NSArray *)assetURLs;
- (void)getAssetsGroupsWithTypes:(ALAssetsGroupType)groupTypes;
- (void)getAssetsFromGroup:(ALAssetsGroup *)group withFilter:(ALAssetsFilter *)filter;

And the following delegate methods corresponding to above. AssetsAccessorDelegate Methods

- (void)assetDidLoadByURL:(ALAsset *)asset;
- (void)assetDidFailLoadWithError:(NSError *)error;
- (void)assetsDidLoadByURLs:(NSArray *)assets;
- (void)assetsGroupsDidLoad:(NSArray *)groups;
- (void)assetsDidLoadByGroup:(NSArray *)assets;

Example

ExampleViewController.h

#import <UIKit/UIKit.h>
#import "AssetsAccessor.h"

@interface ExampleViewController : UIViewController <AssetsAccessorDelegate> {
    AssetsAccessor *assetsAccessor;
}

ExampleViewController.m

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    assetsAccessor = [[AssetsAccessor alloc] initWithDelegate:self];
    
    [assetsAccessor getAssetsGroupWithTypes:ALAssetsGroupAll];
}

#pragma mark - AssetsAccessorDelegate Methods

- (void)assetsGroupsDidLoad:(NSArray *)groups{
    NSLog(@"assetsGroupsDidLoad:%@",groups);
    
    ALAssetsGroup *aGroup = groups[0];
    [assetsAccessor getAssetsFromGroup:aGroup withFilter:[ALAssetsFilter allPhotos]];
}

- (void)assetsDidLoadByGroup:(NSArray *)assets{
    NSLog(@"assetsDidLoadByGroup:%@",assets);
    
    ALAsset *anAsset = assets[0];
    NSURL *imageURL = [[anAsset defaultRepresentation] url];
    [assetsAccessor getAssetByURL:imageURL];
}

- (void)assetDidLoadByURL:(ALAsset *)asset{
    NSLog(@"assetDidLoadByURL:%@",asset);
}

@end

About

[DEPRECATED] A Class for accessing Assets (photos and videos) in iOS device using the Assets Library Framework.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published