title: Retrieve Multiple Images Using PHAsset
body: <p>I'm trying to retrieve over 1,000 images from the user's camera roll with PHAsset but it ends up crashing or taking a long time if it's just thumbnails. Here is my function where I retrieve the images...</p>
  
  <pre><code>func retrieveImages(thumbnail: Bool) {
  
      /* Retrieve the items in order of modification date, ascending */
      let options = PHFetchOptions()
      options.sortDescriptors = [NSSortDescriptor(key: "modificationDate",
          ascending: false)]
  
      /* Then get an object of type PHFetchResult that will contain
      all our image assets */
      let assetResults = PHAsset.fetchAssetsWithMediaType(.Image,
          options: options)
  
      let imageManager = PHCachingImageManager()
  
      assetResults.enumerateObjectsUsingBlock{(object: AnyObject!,
          count: Int,
          stop: UnsafeMutablePointer&lt;ObjCBool&gt;) in
  
  
          if object is PHAsset{
              let asset = object as! PHAsset
              print("Inside  If object is PHAsset, This is number 1")
  
              var imageSize: CGSize!
  
              if thumbnail == true {
                  imageSize = CGSize(width: 100, height: 100)
  
              } else {
                  imageSize = CGSize(width: self.cameraView.bounds.width, height: self.cameraView.bounds.height)
  
              }
              /* For faster performance, and maybe degraded image */
              let options = PHImageRequestOptions()
              options.deliveryMode = .FastFormat
              options.synchronous = true
  
              imageManager.requestImageForAsset(asset,
                  targetSize: imageSize,
                  contentMode: .AspectFill,
                  options: options,
                  resultHandler: { (image, _: [NSObject : AnyObject]?) -&gt; Void in
                      if thumbnail == true {
                          self.libraryImageThumbnails.append(image!)
                          self.collectionTable.reloadData()
                      } else {
                          self.libraryImages.append(image!)
                          self.collectionTable.reloadData()
  
                      }
              })
  
              /* The image is now available to us */
  
              print("enum for image, This is number 2")
  
  
  
              print("Inside  If object is PHAsset, This is number 3")
          }
          print("Outside If object is PHAsset, This is number 4")
  
      }
  
  
  
  }
  </code></pre>
  
  <p>Please tell me if any more information is needed. Thank you!</p>