如何解决"本地方法不是在装code&QUOT允许的;错误 [英] How to solve "Native methods are not allowed in loaded code" error

查看:227
本文介绍了如何解决"本地方法不是在装code&QUOT允许的;错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让我的应用程序运行的声音,而在待机模式下的剧本,我把这种说法在启动

I want to let my app to run sound while the playbook in standby mode, I put this statement in the start up

QNXSystem.system.inactivePowerMode = QNXSystemPowerMode.THROTTLED;

现在当我调试在模拟器上(而不是台式机调试器)的应用程序,我得到这个错误

Now when I debug the app on the simulator (not desktop debugger) I got this error

VerifyError: Error #1079: Native methods are not allowed in loaded code.

和这个错误我也使用AlertDialog时。

And this error I got also when using AlertDialog.

注:我使用Flash Builder和我已经把QNX SWC在库中的路径。 ....所以要解决这些问题?

Note: I am using Flash builder, and I have put the qnx SWC in the libraries path. .... so to solve these problems?

推荐答案

要允许code编译瓦特/原生扩展到在模拟器上运行,我们不得不把code,它的方法是将采用原生扩展(当在模拟器上)从来没有被执行。

To allow code compiled w/native extensions to run on the simulator, we had to put code that used native extensions in methods that would never get executed (when on the simulator).

这是不够的,只是包裹在一个if / else块违规code。的的if / else需要调用其他方法,要么具有原生版本或的code模拟器版本。

It wasn't enough to just wrap the offending code in an if/else block. The if/else needs to call another method that either has the native version or the simulator version of the code.

例如:

private function showNativeOrFlexAlert(message:String):void
{
    // we used the Capabilities class to determine this, might be a better way
    if (isMobile)
        showNativeAlert(message);
    else
        showFlexAlert(message);
}

// have to be careful here, this method signature CANNOT include
// any classes from native extension -- no errors on device, but fails on simulator
private function showNativeAlert(message:String):void
{
    // use native API to show alert
}
private function showFlexAlert(message:String):void
{
    // use the Flex Alert class
}

这篇关于如何解决"本地方法不是在装code&QUOT允许的;错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆