title: Posting with UIActivityViewController, but avoiding cropping?
body: <p>Say you construct an image that is fullscreen on different devices.  You then use UIActivityViewController to post to - for example - Instagram in the normal way.</p>
  
  <p>The user clicks your share button, it brings up the usual iOS-sharing-thingy,</p>
  
  <p><a href="https://i.stack.imgur.com/v75Wg.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v75Wg.jpg" alt="enter image description here"></a></p>
  
  <p>and you can post to Instagram (assuming the user's an Instagram user of course).  No worries.</p>
  
  <p>But typically the image is cropped on Instagram - you lose a little of the top and bottom.</p>
  
  <p>Is there actually any solution for this?</p>
  
  <p>Note that indeed - say you open the normal Photos app on the iPhone, and "share" and post on Instagram ... <strong>you lose a little of the top and bottom</strong>!</p>
  
  <p>When the user does click the Instagram icon on this ...</p>
  
  <p><a href="https://i.stack.imgur.com/v75Wg.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v75Wg.jpg" alt="enter image description here"></a></p>
  
  <p>in fact is there a way for me then to <strong><em>go back, be aware of the user's choice, and make the image the appropriate size</em></strong>?</p>
  
  <p>Is there perhaps a way to <strong><em>pass a selection of images (various sizes)</em></strong> to the UIActivityViewController?</p>
  
  <p>What's the deal on this, it seems like a basic failing?</p>
  
  <p>Note - I'm fully aware that BEFORE going to the iOS-share-thingy, I could ask the user myself "What size image would you like me to make?"</p>
  
  <p>Note - I'm aware that it's in some cases possible to post "directly" to say Instagram inside the app, without using Apple's share system; that's lame though.</p>
  
  <p>To save anyone typing, here's some clean code to bring up the iOS-share system...</p>
  
  <pre><code>    @IBAction func userClickedOurShareButton()
          {
          let s:[AnyObject] = [buildImage()]
          let ac = CleanerActivity(activityItems:s, applicationActivities:nil)
  
          ac.popoverPresentationController?.sourceView = view
          // needed so that iPads won't crash. sarcasm: thanks Apple
  
          ac.excludedActivityTypes = [UIActivityType.assignToContact,
              UIActivityType.saveToCameraRoll,
              UIActivityType.addToReadingList,
              UIActivityType.copyToPasteboard ]
  
          // consider UIActivityTypeMessage also
  
          if #available(iOS 9.0, *) {
                  ac.excludedActivityTypes?.append(UIActivityType.openInIBooks)
              } else {
                  // Fallback on earlier versions
              }
  
          self.present(ac, animated:false, completion:nil)
          }
  
  
  class CleanerActivity: UIActivityViewController {
  
      func _shouldExcludeActivityType(_ activity: UIActivity) -&gt; Bool {
          let activityTypesToExclude = [
              "com.apple.reminders.RemindersEditorExtension",
              "com.apple.mobilenotes.SharingExtension",
              "com.google.Drive.ShareExtension",
              "com.apple.mobileslideshow.StreamShareService"
          ]
  
          if let actType = activity.activityType {
              if activityTypesToExclude.contains(actType.rawValue) {
                  return true
              }
              else if super.excludedActivityTypes != nil {
                  return super.excludedActivityTypes!.contains(actType)
              }
          }
          return false
      }
  </code></pre>