如何使两个AIR IOS应用程序通信?

如何使两个AIR IOS应用程序通信?,ios,air,Ios,Air,一种可能的解决方案是使用自定义URL: 我遵循,然后进一步探索IOS中两个AIR应用程序的通信。 -第一个应用程序使用自定义URI“fbMY_app_ID”,如第一步所述,Safari可以调用它。 -第二个应用程序使用带有自定义URI的URLRequest与第一个应用程序通信 我得到错误:“SecurityError:error#2193:Security沙盒冲突:navigateToURL:app:/secondApp.swf无法访问tfbMY#u app\u ID://test” 我是否在这

一种可能的解决方案是使用自定义URL:

我遵循,然后进一步探索IOS中两个AIR应用程序的通信。 -第一个应用程序使用自定义URI“fbMY_app_ID”,如第一步所述,Safari可以调用它。 -第二个应用程序使用带有自定义URI的URLRequest与第一个应用程序通信

我得到错误:“SecurityError:error#2193:Security沙盒冲突:navigateToURL:app:/secondApp.swf无法访问tfbMY#u app\u ID://test”

  • 我是否在这种方法中遗漏了什么?有办法解决这个问题吗
  • 除了使用自定义URL,还有其他方法吗

  • 根据Adobe AIR实施的安全沙箱,navigateURL仅限于众所周知的协议,如http:、https:、sms:、tel:、mailto:、file:、app:、app storage:、VipacAccess:和connectpro:。您可以通过和找到更多信息


    一种解决方法是使用html页面作为中间层,页面将在其中中继调用。

    您可以像这样从应用程序清单文件添加自定义协议(您可以添加多个协议)

    要侦听呼叫并实际处理正在传递的数据,请执行以下操作:

    NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE,_invokeHandler);
    
    事件处理程序将按如下方式处理数据:

    <a href="thisIsSomeCustomAppProtocol://SomeCustomDataString_goes_here&use_url_encoded_strings:">This will call the App with some parameters included (if need be)</a>
    
    var _customURL_str:String       = "thisIsSomeCustomAppProtocol://SomeCustomDataString_goes_here&use_url_encoded_strings";
    var _isProtocolAvailable:Boolean= URLUtils.instance.canOpenUrl(_customURL_str);
    //
    if(_isProtocolAvailable)
    {
        navigateToURL(new URLRequest(_customURL_str));
    }
    
    private function onInvoke(e:InvokeEvent):void
    {
        //...
        var _queryString:String = e.arguments[0] ? e.arguments[0] : "";
        //
        if(_queryString.length > 0){
            //handle the incomming data string
        }else{
            //no extra data string was sent
        }
        //...
    }
    
    希望有帮助

    干杯:

    -尼克

    private function onInvoke(e:InvokeEvent):void
    {
        //...
        var _queryString:String = e.arguments[0] ? e.arguments[0] : "";
        //
        if(_queryString.length > 0){
            //handle the incomming data string
        }else{
            //no extra data string was sent
        }
        //...
    }