.delegate = self

Hi,

Inside PluginLibrary.mm, I’m adding a method to share a video over sms, no issues except for the delegate.

MFMessageComposeViewController \*messageController = [[MFMessageComposeViewController alloc] init]; messageController.messageComposeDelegate = self;

My first thought was AppCoronaDelegate but I can’t seem to access that. I tried creating an @interface inside my PluginLibrary but it caused a ton of errors.

Since self doesn’t exist, what should I set the MessageComposeDelegate to? 

Thanks,

Aidan

You would have to implement message MFMailComposeViewControllerDelegate protocol in your code. This protocol responds to single message when sending is failed of succeeded. Usually, Corona plugin would dispatch an event or call listener in implementation of that message.

AppCoronaDelegate does not implement MFMailComposeViewControllerDelegate. I would recommend looking up some tutorial on how to use MFMailComposeViewController. Code you provided is not enough to give you more specific recommendations.

And you should be able to create interface inside your PluginLibrary.mm without any problems. So I went ahead and wrote simple working plugin which both implements delegate and sends a message: https://gist.github.com/Shchvova/8b15e5afe0a64357e1c8b6a3eaa95e7e .

It will attempt to send “Hello!” message, and then it will listen to delegate, and send back Lua event to listener specified in library.init(listener), with status of sent message.

I hope you can take it from here.

Thank you for choosing Corona!

Note:

“Library” doesn’t refer to any plugin. It refers to Dictionary Library, which is what demo plugin does. May be it would be nice idea to rename it to PluginMessages or something… 

@vlads awesome awesome awesome code, helped me wrap my mind around what’s actually going on.

Thank you so much!

You would have to implement message MFMailComposeViewControllerDelegate protocol in your code. This protocol responds to single message when sending is failed of succeeded. Usually, Corona plugin would dispatch an event or call listener in implementation of that message.

AppCoronaDelegate does not implement MFMailComposeViewControllerDelegate. I would recommend looking up some tutorial on how to use MFMailComposeViewController. Code you provided is not enough to give you more specific recommendations.

And you should be able to create interface inside your PluginLibrary.mm without any problems. So I went ahead and wrote simple working plugin which both implements delegate and sends a message: https://gist.github.com/Shchvova/8b15e5afe0a64357e1c8b6a3eaa95e7e .

It will attempt to send “Hello!” message, and then it will listen to delegate, and send back Lua event to listener specified in library.init(listener), with status of sent message.

I hope you can take it from here.

Thank you for choosing Corona!

Note:

“Library” doesn’t refer to any plugin. It refers to Dictionary Library, which is what demo plugin does. May be it would be nice idea to rename it to PluginMessages or something… 

@vlads awesome awesome awesome code, helped me wrap my mind around what’s actually going on.

Thank you so much!