In order to replace FolderItem.Launch that does not work on IOS, I went through what exists and I found out something related to UIActivityViewController. I have found an article called: Share a PDF (or any file) through UIActivityViewController from Jeremie Leroy. Using that principle,
I made this code:
Dim urlField As Text = "file://"+ yourlocalfile
Declare Function CFURLCreateStringByAddingPercentEscapes Lib "Foundation" (allocator As Ptr, origString As CFStringRef, charactersToLeaveUnescaped As CFStringRef, legalURLCharactersToBeEscaped As CFStringRef, encoding As UInt32) As CFStringRef
Dim encodedURL As Text
encodedURL = CFURLCreateStringByAddingPercentEscapes(Nil, urlField, Nil, Nil, &h08000100)
using Extensions
using Foundation
using UIKit
dim controller as UIActivityViewController
//create the controller -> create a single item array with an nsobject representing the image
//File
Dim fileArr As NSArray = NSArray.CreateWithObject(NSURL.FileURLWithPath(urlField))
controller = new UIActivityViewController(fileArr, nil)
if isIPad then
controller.modalPresentationStyle = UIKit.UIViewController.UIModalPresentationStyle.popover
controller.modalInPopover = true
end if
// To exclude some apps
Dim excludeArr As NSArray = NSArray.CreateWithObject( new NSString(UIActivity.UIActivityTypePrint))
excludeArr = excludeArr.ArrayByAddingObject(new NSString(UIActivity.UIActivityTypeCopyToPasteboard))
excludeArr = excludeArr.ArrayByAddingObject(new NSString(UIActivity.UIActivityTypeMail))
controller.excludedActivityTypes = excludeArr
//present with nil completion handler
self.PresentViewController(controller, True, nil)
if isIPad then
//Then we set the popOverController position on the Toolbutton that called it
Dim popController As UIKit.UIPopoverPresentationController = controller.popoverPresentationController()
popController.barButtonItem = button2.Handle
end if
Everything works. The panel opens but when I select “Copy into Adobe Acrobat”, NOTHING HAPPENS. The file is not opened in Acrobat, nor when I open Acrobat, my document does not appear.
So, I am wondering if I am missing something.