LIBGDX MOE-IOS "Share" Text

Hi

I have a share button but how do I share the text just like “intents” in Android, where it will show up a list of application for your to select for which apps to send the “text”.

Code below is not working in Intel-MOE:
NSString textShare = new NSString(“This is the text to share”);
NSArray texttoshare = new NSArray(textShare);
UIActivityViewController share = new UIActivityViewController(texttoshare,null);
presentViewController(share, true, null);

Hi,

The API you are trying to use is correct, but you are using non-existent constructors and methods. MOE’s method naming and object creation is closer to that available to Objective-C. Please try this instead:

NSArray texttoshare = NSArray.arrayWithObject("This is the text to share");
UIActivityViewController share = UIActivityViewController.alloc().initWithActivityItemsApplicationActivities(texttoshare,null);
presentViewControllerAnimatedCompletion(share, true, null);
1 Like