Hello,
I am trying to understand how to build an iOS Plugin for Corona. I did so with Android but cannot understand a basic issue I am having.
With Android, I am able to call a plugin AND have it run with Corona in the background. So, I am able to “listen” to events in the background and push more events as it ran.
With iOS, although I just started and trying to figure it out, it seems like it’s not the case. I simply run the example App with xCode and added 4 lines of code to constantly print “Corona is Running” every half a second, and changed the delay of plugin “show” to 5 seconds.
So, once the “show” is called the Corona engine stops printing, and only continues when I dismiss the native element.
-
Is this normal?
-
Is there a way to run them parallelly?
Thank you,
Mars Team
Code:
local library = require "plugin.library" -- This event is dispatched to the global Runtime object -- by `didLoadMain:` in MyCoronaDelegate.mm local function delegateListener( event ) native.showAlert( "Event dispatched from `didLoadMain:`", "of type: " .. tostring( event.name ), { "OK" } ) end Runtime:addEventListener( "delegate", delegateListener ) -- This event is dispatched to the following Lua function -- by PluginLibrary::show() in PluginLibrary.mm local function listener( event ) print( "Received event from Library plugin (" .. event.name .. "): ", event.message ) end library.init( listener ) -- ADDED THIS BLOCK --------------- local function newListener() print("Corona is Running") end timer.performWithDelay( 500, newListener,0 ) ------------------------------------- -- Changed to 5000 from 500 timer.performWithDelay( 5000, function() library.show( "corona" ) end )