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].
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.
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];
}
Copy link to clipboard
Copied
Did you try without the "?" in the arg?
Copy link to clipboard
Copied
Yes, tried that - doesn't work. I still get 'null' returned as the URL.
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].