- Home /
Question by
dappledore · Feb 14, 2017 at 02:30 AM ·
iospluginobjective-c
Making a plugin from objective C code
I have some objective - c code below, i want to call from Unity, i know i need to make a .m and .h file but im not to sure about how to go about it, i dont have much experience in objective-c , what would be the content , imports etc for a .m and .h file that i would put in the assets/plugins/ios folder? https://developer.apple.com/reference/messageui/mfmessagecomposeviewcontroller?language=objc
-(IBAction) sendInAppSMS:(id) sender
{
MFMessageComposeViewController *controller = [[[MFMessageComposeViewController alloc] init] autorelease];
if([MFMessageComposeViewController canSendText])
{
controller.body = @"Hello from Mugunth";
controller.recipients = [NSArray arrayWithObjects:@"12345678", @"87654321", nil];
controller.messageComposeDelegate = self;
[self presentModalViewController:controller animated:YES];
}
}
Comment
Answer by hexagonius · Feb 14, 2017 at 09:43 PM
This is the page that helps you create an iOS plugin:
https://docs.unity3d.com/Manual/PluginsForIOS.html
or Mac OS X: