【问题标题】:AIR Native process ErrorAIR 本机进程错误
【发布时间】:2013-05-15 09:21:03
【问题描述】:

我尝试在 Mac 上使用 NativeProcess 启动程序。

pathEV="/Applications/MyFolder/MyAppOSX.app"
var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
var fileEV:File = new File();
fileEV=fileEV.resolvePath(pathEV);
nativeProcessStartupInfo.executable = fileEV;
var process:NativeProcess = new NativeProcess();
process.start(nativeProcessStartupInfo); 

但是出现了这个错误: 错误 #3214:NativeProcessStartupInfo.executable 未指定有效的可执行文件

你能帮我解决这个问题吗? 谢谢

【问题讨论】:

    标签: actionscript-3 apache-flex air


    【解决方案1】:

    尚未对其进行测试,但我假设您需要运行 open 并将应用程序的路径作为参数,如下所示:

    pathEV:String="/Applications/MyFolder/MyAppOSX.app"
    var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
    var fileEV:File = new File();
    fileEV=fileEV.resolvePath( '/usr/bin/open' );
    nativeProcessStartupInfo.arguments = Vector.<String>([pathEV]);
    nativeProcessStartupInfo.executable = fileEV;
    var process:NativeProcess = new NativeProcess();
    process.start(nativeProcessStartupInfo); 
    

    是的,这绝对需要extendedDesktop 权限

    仅供参考:Vector shizzle 是正确的,我用它来将数组转换为 Vector,而不是作为构造函数

    Here's an explanation how to launch .app files from the terminal

    【讨论】:

      【解决方案2】:

      您是否需要将&lt;supportedProfiles&gt;extendedDesktop&lt;/supportedProfiles&gt; 添加到您的清单文件中?

      另外,我相信.app is not an executable。它实际上只是一个应用程序包,其中存在实际的可执行文件。首先尝试指向 /bin/ls 以确保一切正常,然后在 .app 文件夹中挖掘以找到您的可执行文件。

      【讨论】:

      • 我还在清单文件中添加了 extendedDesktop。在 MacOs 上,.app 就像一个可执行文件,试着测试你的想法。谢谢
      【解决方案3】:

      为什么需要 nativeProcess?为什么不直接使用 fileEV.openWithDefaultApplication() ?

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-02-04
        • 1970-01-01
        • 1970-01-01
        • 2012-08-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多