title: swift 4, Using UIActivityViewController to share image to facebook and other app crashes
body: <p>In my app I am trying to share large images to another apps. But when I send a large size image to like facebook the facebook comes up but it crashes. When I resize the image to a small size it doesn't crash.</p>
  
  <p>I tried to share large images in the camera roll but in the camera roll it doesn't crash and shares it with original image size.</p>
  
  <p>Is there a different way to do this using UIActivityViewController?</p>
  
  <p>var shareImage = UIImage
  shareImage.removeAll()</p>
  
  <pre><code>    for i in 0...deletePhotoArray.count - 1 {
          let asset = AlbumModel.allPhotos?.object(at: deletePhotoArray[i])
          let options = PHImageRequestOptions()
          options.version = .current
          options.isSynchronous = true
          options.deliveryMode = .fastFormat
          PHImageManager.default().requestImage(for: asset!, targetSize: PHImageManagerMaximumSize, contentMode: .aspectFit, options: options) { (image, info) in
              shareImage.append(image!)
          }
  
      }
  
      let activityViewController = UIActivityViewController(activityItems: shareImage, applicationActivities: nil)
      activityViewController.popoverPresentationController?.sourceView = self.view // so that iPads won't crash
  </code></pre>