I am trying to make an app to view a PDF and save it in iBooks, mail it and print it. Right now I am using the following code:
if (UIDevice.CurrentDevice.CheckSystemVersion(6, 0))
{
AppDelegate appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate;
//url to local PDF
var items = new NSObject[] { NSData.FromFile(_pdfUrl) };
var activityController = new UIActivityViewController(items, null);
activityController.ExcludedActivityTypes = new NSString[]
{
UIActivityType.AssignToContact,
UIActivityType.Message,
UIActivityType.PostToFacebook,
UIActivityType.PostToTwitter,
UIActivityType.PostToWeibo,
UIActivityType.CopyToPasteboard,
UIActivityType.SaveToCameraRoll
};
PresentViewController(activityController, true, null);
}
When I press on the button to perform this code, I see the viewcontroller, but only with Mail and Print(Tested on a device with iBooks). My Question is: Is "Open in iBooks" something that I will have to add myself? Or am I doing something wrong?
Another Question is when doing the same in iOS5, I use UIDocumentInteractionController:
UIDocumentInteractionController doc = UIDocumentInteractionController.FromUrl(new NSUrl(_pdfUrl, false));
doc.WeakDelegate = this;
doc.PresentOptionsMenu(btn.Frame, this, true);
But nothing happened (iPhone Simulator, don't have a device with iOS 5). In another post someone said that if iBooks isn't on the device nothing will happen. But what about Mail and Print?
Can someone help me out on this?
Thanks in advance
EDIT:
using this code in iOS 6 works perfectly:
UIDocumentInteractionController doc = UIDocumentInteractionController.FromUrl(new NSUrl(_pdfUrl, false));
doc.WeakDelegate = this;
doc.PresentOptionsMenu(btn.Frame, this, true);
EDIT:
I am looking for a way to show Mail and Print on iOS5 using UIDocumentInteractionController. Any ideas anyone?