【问题标题】:Adobe Flex/AIR iOS App - How to pass arguments into app?Adobe Flex/AIR iOS App - 如何将参数传递给应用程序?
【发布时间】:2014-08-05 09:09:01
【问题描述】:

我可以使用链接example://abc 成功打开我的应用程序。

但是我需要在 URI 的末尾捕获 abc 参数。

这是应用程序的代码

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
           xmlns:s="library://ns.adobe.com/flex/spark" applicationDPI="240"
           creationComplete="creationComplete(event)">

    <fx:Script>
        <![CDATA[
            import mx.events.FlexEvent;

            protected function creationComplete(event:FlexEvent):void
            {
                NativeApplication.nativeApplication.addEventListener(BrowserInvokeEvent.BROWSER_INVOKE, onInvokeEvent);
            }

            private function onInvokeEvent(e:BrowserInvokeEvent):void 
            { 
                var arguments:Array = e.arguments; 

                testLabel.text = "Args passed" //This never happens
            }

        ]]>
    </fx:Script>

    <s:Label id="testLabel" x="56" y="163" text="Testing invocation"/>

</s:Application>

我还确保对 app.xml 文件进行这些更改:

<allowBrowserInvocation>true</allowBrowserInvocation>

<iPhone>
    <InfoAdditions><![CDATA[
        <key>CFBundleURLTypes</key> 
            <array> 
                <dict> 
                     <key>CFBundleURLSchemes</key> 
                    <array> 
                        <string>example</string> 
                    </array> 
                    <key>CFBundleURLName</key> 
                    <string>com.example.app</string> 
                </dict> 
            </array>
    ]]></InfoAdditions>
</iPhone>

我需要进行哪些更改才能捕获此应用的参数?

【问题讨论】:

    标签: ios apache-flex air flash-builder


    【解决方案1】:

    因为我是从另一个应用程序(日历)启动应用程序,所以我需要使用 InvokeEvent 而不是 BrowserInvokeEvent。

    【讨论】:

      猜你喜欢
      • 2011-06-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-04
      • 2012-12-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多