Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
New Developer
flashlover
Posts: 3
Registered: ‎11-03-2010
My Device: Not Specified
Accepted Solution

When using Device.device.os, it throws Error #1079: Native methods are not allowed in loaded code.

Hi all,

 

When I tried to use the Device.device.OS to get the os string. It's compiled smoothly. But it throws error when app launched on my desktop.

 

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

 

It doesn't throw error in emulator, but it doesn't get the OS string.

 

Anybody knows how to use the Device class? Is it still not supported currently?

 

Many thanks!

Please use plain text.
BlackBerry Development Advisor
jdolce
Posts: 172
Registered: ‎10-25-2010
My Device: Not Specified

Re: When using Device.device.os, it throws Error #1079: Native methods are not allowed in loaded code.

 


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


 

This error is thrown on the desktop because your qnx-air.swc is probably being merged as code instead of being linked in your project as external. The reason for it needing to be external is that it contains classes that only exist in the AIR runtime  in the simulator, and not in the AIR runtime on your desktop. The Device classes uses some of the custom AIR extensions we have written in order to get device properties.

 

If you simply want the OS you could also use the Capabilities.os, which is a standard Flash Player API and does not require the use custom extensions.

 

My guess to why it isn't working correctly on the device as well is that the qnx-air.swc is not set to external. Set that back to external and run it in the simulator.

 

Hope that helps

Julian

Please use plain text.
New Developer
flashlover
Posts: 3
Registered: ‎11-03-2010
My Device: Not Specified

Re: When using Device.device.os, it throws Error #1079: Native methods are not allowed in loaded code.

Thank you jdolce!

 

After I set the qnx-air.swc to external, it can get the os string 'QNX' in emulator. Cool!

Please use plain text.