title: To Get all Images from Photo Library in iphone
body: <p>I trying to retrive images from Photo Library &amp; display in my app using AssetsLibrary.
  I got the URL path of photos but I don't know how to get photo through it.</p>
  
  <p>My Code is as Follow:</p>
  
  
  
  <pre class="lang-objc prettyprint-override"><code>   NSMutableArray* assetURLDictionaries = [[NSMutableArray alloc] init];
  
  
     void (^assetEnumerator)( ALAsset *, NSUInteger, BOOL *) = ^(ALAsset *result, NSUInteger index, BOOL *stop) {
         if(result != nil) {
             if([[result valueForProperty:ALAssetPropertyType] isEqualToString:ALAssetTypePhoto]) {
                  [assetURLDictionaries addObject:[result valueForProperty:ALAssetPropertyURLs]];
  
                  NSLog(@"result is:%@",result);
                  NSLog(@"asset URLDictionary is:%@",assetURLDictionaries);
                  NSURL *url= (NSURL*) [[result defaultRepresentation]url]; 
  
                  [library assetForURL:url
                           resultBlock:^(ALAsset *asset) { [assetsp addObject:asset]; }
                          failureBlock:^(NSError *error){ NSLog(@"test:Fail"); } ]; 
             } 
         }
     };
  
  
     NSMutableArray *assetGroups = [[NSMutableArray alloc] init];
     void (^ assetGroupEnumerator) ( ALAssetsGroup *, BOOL *)= ^(ALAssetsGroup *group, BOOL *stop){
          NSLog(@"hi");
          if(group != nil) {
              [group enumerateAssetsUsingBlock:assetEnumerator];
              [assetGroups addObject:group];
  
              NSLog(@"Number of assets in group :%d",[group numberOfAssets]);           
          }
     };
  
     assetGroups = [[NSMutableArray alloc] init];
     ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
  
     [library enumerateGroupsWithTypes:ALAssetsGroupAll
                            usingBlock:assetGroupEnumerator
                          failureBlock:^(NSError *error) {NSLog(@"A problem occurred");}];
  </code></pre>