Highlighted

onInvoke doesn't pass parameters on iOS

Explorer ,
Feb 24, 2017

Copy link to clipboard

Copied

Hi,

On iOS, the onInvoke event doesn't pass the parameters from a customer URL link _unless_ the iOS app is running. I have used all the docs and examples, and the onInvoke event fires correctly - but the event.arguments is empty if the app is opened. Once the app is running, the link from the browser works as expected, and the event.arguments is populated.

The condition above makes the onInvoke event useless for most users. Anyone find a workaround?

After a lot of testing, I came to the solution: the INVOKE event is being fired twice in rapid succession when the app is first opened using the above code. The first event has the proper URL in it, while the second is empty. If the app is open already, the event is still fired, but both times it contains the proper URL in the arguments[0].

TOPICS
Air beta

Views

498

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

onInvoke doesn't pass parameters on iOS

Explorer ,
Feb 24, 2017

Copy link to clipboard

Copied

Hi,

On iOS, the onInvoke event doesn't pass the parameters from a customer URL link _unless_ the iOS app is running. I have used all the docs and examples, and the onInvoke event fires correctly - but the event.arguments is empty if the app is opened. Once the app is running, the link from the browser works as expected, and the event.arguments is populated.

The condition above makes the onInvoke event useless for most users. Anyone find a workaround?

After a lot of testing, I came to the solution: the INVOKE event is being fired twice in rapid succession when the app is first opened using the above code. The first event has the proper URL in it, while the second is empty. If the app is open already, the event is still fired, but both times it contains the proper URL in the arguments[0].

TOPICS
Air beta

Views

499

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Feb 24, 2017 0
Engaged ,
Feb 24, 2017

Copy link to clipboard

Copied

I don't know how you did it but it woks for me even when the app isn't running when the user click on the link.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 24, 2017 0
Explorer ,
Feb 24, 2017

Copy link to clipboard

Copied

That's great to hear. I haven't been able to make it work. Using the code below, the _appURL variable is empty if the app hasn't been started previously. If it has, _appURL has the full path from the HTML properly passed. You are seeing different results? How?

HTML: <a href="myapp://?taskID=1010181">Preview a Task</a>

And in the AS3 code:

// in startup code

NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, onInvoke);

// onInvoke callback

  public function onInvoke(event:InvokeEvent):void {

 

       var args:Array = event.arguments;

       _appFullArgs = args;

       _appURL = args[0];

}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 24, 2017 0
Engaged ,
Feb 24, 2017

Copy link to clipboard

Copied

Did you try without the "?" in the arg?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 24, 2017 0
Explorer ,
Mar 23, 2017

Copy link to clipboard

Copied

Yes, tried that - doesn't work. I still get 'null' returned as the URL.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 23, 2017 0
Explorer ,
Apr 04, 2017

Copy link to clipboard

Copied

After a lot of testing, I came to the solution: the INVOKE event is being fired twice in rapid succession when the app is first opened using the above code. The first event has the proper URL in it, while the second is empty. If the app is open already, the event is still fired, but both times it contains the proper URL in the arguments[0].

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 04, 2017 0