2017-03-06 37 views
0

我想实现OneSignal Corna SDK用于接收推送通知, 但它给我一个运行时错误与实施OneSignal Corna SDK

栈回溯问题/Corona/Simulator/Plugins/plugin_OneSignal.lua:49:在功能“初始化” main.lua:52:主块

+0

[链接](https://documentation.onesignal.com/docs/corona-sdk)文档和论坛[OneSignal] (https://forums.coronalabs.com/forum/640-onesignal/)。 – ldurniat

回答

0

此错误意味着有可能在你的代码中的语法错误。请确保您已正确格式化的调用OneSignal init方法,像这样:

-- This function gets called when the user opens a notification or one is received when the app is open and active. 
-- Change the code below to fit your apps needs. 
function DidReceiveRemoteNotification(message, additionalData, isActive) 
    if (additionalData) then 
    if (additionalData.discount) then 
     native.showAlert("Discount!", message, { "OK" }) 
     -- Take user to your app store 
    elseif (additionalData.actionSelected) then -- Interactive notification button pressed 
     native.showAlert("Button Pressed!", "ButtonID:" .. additionalData.actionSelected, { "OK"}) 
    end 
    else 
    native.showAlert("OneSignal Message", message, { "OK" }) 
    end 
end 

local OneSignal = require("plugin.OneSignal") 
-- Uncomment SetLogLevel to debug issues. 
-- OneSignal.SetLogLevel(4, 4) 
OneSignal.Init("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "############", DidReceiveRemoteNotification)