title: How to save a PDF file created in my app to iBooks with UIActivityViewController?
body: <p>I am creating a <strong>pdf</strong> in my ios9 app and would like to be able to save it to iBooks with the UIActivityViewController. Unfortunately, with the code I'm currently using (assuming that all options using : </p>
  
  <pre><code>   applicationActivities: nil 
  </code></pre>
  
  <p>for what I can do with the file will show up) only the "Message" and "Mail" items show up. I'm not excluding any activities, so hypothetically UIActivityTypeOpenInIBooks should show up just fine. However, I can't get iBooks or anything but Message and Mail show up. (For future reference I will refer to this outcome as outcome <strong>A</strong> ) Is there another recommended way of doing this?
  The code I'm using is below:</p>
  
  <pre><code>  // creating pdf image from the UIView
    let pdf = self.getPDFImageFromDrawingView()
  
    let activityViewController = UIActivityViewController(activityItems: [pdf], applicationActivities: nil) //should include any and all available activities right?
  
    self.presentViewController(activityViewController, animated: true, completion: nil)
  </code></pre>
  
  <p>Is there something obvious I'm forgetting? How do you include iBooks as an option for saving files? </p>
  
  <p><strong>EDIT :</strong> </p>
  
  <p>In debugging this issue, I've saved the UIView content as a JPG AND as a pdf file. When I use ONLY the generated UIImage as such: </p>
  
  <p><strong>(outcome B)</strong></p>
  
  <pre><code>    let image = self.getUIImageFromDrawingView() // generate a UIImage object
      let activityViewController = UIActivityViewController(activityItems: [image], applicationActivities: nil)
      self.presentViewController(activityViewController, animated: true, completion: nil)
  </code></pre>
  
  <p>all the possible options show up, including open in iBooks (YES! But I need the much-higher resolution image generated by creating a PDF.)</p>
  
  <p>When I add <strong>BOTH the image and the pdf</strong> to the activityItems (as such:</p>
  
  <p><strong>(outcome C)</strong></p>
  
  <pre><code>let image = self.getUIImageFromDrawingView() // UIImage
  let pdf = self.getPDFImageFromDrawingView() //produces an NSData object
  let activityViewController = UIActivityViewController(activityItems: [image, pdf], applicationActivities:nil)
  </code></pre>
  
  <p>), I get more options then the original mail and message options - like FB, Pinterest and Evernote - but no iBooks.</p>
  
  <p>Finally, when I go back to using only the PDF, I have the same things as before - only mail and messages. What could be causing this? 
  (BTW, interesting if not useless aside - when using both the JPG and the PDF, and testing the applicationActivities with Mail - I get the email of a jpg and a pdf, as expected. So the files are being generated as expected).</p>
  
  <p>What could be causing this weird behavior?</p>
  
  <p><strong>EDIT 2 :</strong> </p>
  
  <p>I Thought that may be the problem was that I was using NSData to send the pdf. So, I saved the object as an NSURL and used that. I got the same result as in <strong>(C)</strong> above - more options then just Messages and Mail, but no iBooks. This outcome came with using both the UIImage + NSURL combination, AND when using NSURL alone. When I used UIImage alone, I had many many options, as in the previous situation, including iBooks.</p>