调用device.showAlert()出错

quick v3.3 ,由于cocos code ide 不支持 3.3 所以手动降为 3.2 , 在调用设备函数时报错
device.showAlert(“Confirm Exit”, “Are you sure exit game ?”, {“YES”, “NO”},function(event) print(“sssssss”) end)

LUA ERROR: :207: attempt to index field ‘Native’ (a nil value)

stack traceback:
:207: in function ‘showAlert’
:87: in function <:40>
:58: in function ‘dispatchEvent’
:18: in function ‘getChildEvent’
:11: in function <:10>
:58: in function ‘dispatchEvent’
:116: in function ‘listener_’
:364: in function <:318>

感谢反馈,

将device.showAlert函数里的Native改为cc.Native吧,
最新的3.3中是修改了的

我用的就是v3.3 中是版本设定成 3.2 了 ,我看了原程序 是 cc 开头的 。但

cc.Native:createAlert(title, message, defaultLabel)
    for i, label in ipairs(buttonLabels) do
        cc.Native:addAlertButton(label)
    end

没看懂,这个代码应该是对的吧

我自己在v3.3的player mac上试了下,可以出弹出框

local function onButtonClicked(event)
if event.buttonIndex == 1 then
print(“click yes”)
else
print(“click no”)
end
end

device.showAlert("Confirm Exit",
    "Are you sure exit game ?",
    {"YES", "NO"},
    onButtonClicked)