self.PresentViewController in iOSKit doesn't work on a MobileScreen

This code to share a file in iOSKit doesn’t work:

dim controller as UIActivityViewController
//create the controller → create a single item array with an nsobject representing the image
//the second parameter is an NSArray of custom UIActivity objects, just pass nil since custom object
//UIActivity creation is difficult in xojo
'controller = new UIActivityViewController(NSArray.CreateWithObject(new NSObject(b.Image.Handle)),nil)
dim url as Foundation.NSURL = Foundation.NSURL.FileURLWithPath(f.NativePath)
controller = new UIActivityViewController(NSArray.CreateWithObject(url),nil)
// controller.excludedActivityTypes = NSArray.CreateWithObject( new NSString(UIActivity.UIActivityTypePrint))
//present with nil completion handler
self.PresentViewController(controller, True, nil)

Because:
Type “ScrExport” has no member named “PresentViewController”
self.PresentViewController(controller, True, nil)

Please try to change the PresentViewController definition to use an MobileScreen instead of an iOSView and I think that should fix the problem.

I use UIKit 2.0.2
There are many entries with “PresentViewController” in the UIKit and all have

PresentInView(mView as MobileScreen)
declare sub presentViewController lib UIKitLib selector “presentViewController:animated:completion:” _
(obj_id as ptr, controller as ptr, animated as Boolean, completion as ptr)
presentViewController(mView.ViewControllerHandle, self, True, nil)

mparentViewController = mView //get a reference to dismiss ourself

But “UIActivityViewController” has now MobileScreen or iOSView entry.

I may not be understanding your question. But I was saying youll need to update the definition of the Extensions.PresentViewController method: iOSKit/Extensions.xojo_code at master · kingj5/iOSKit · GitHub

Trying to use MFMailComposeViewController getting same error, tried to replace all iosView with MobileScreen but still get the error… (looking for hidden iosView in Extensions) is replacing all iosView with MobileScreen the correct way to go?

Roger

I believe so… please let me know if that works or not and I can try to do the same in iOSKit

I think Im Close… Still getting this error :

Extensions.Frame, line 7
This method extends class iOSView, but the base expression is class MobileScreen.
Return frame_(mView.View)

//FOUND IT … must set View in methods to MobileScreen

Jason King,

Replacing iosView everywhere does work. BUT you have to replace in Properties and declares also…

Thx
Roger