Skip to main content
Known Participant
February 15, 2012
Question

Passing app arguments via InvokeEvent or BrowserInvokeEvent in AIR for IOS doesn't work

  • February 15, 2012
  • 2 replies
  • 10333 views

Just figured I'd let everyone know that if you thought it'd be cool to let your IOS users launch your app from a link in a browser and that it would be cool to encode parameters in that URL to be passed into your app, you're out of luck.  When you add a listener to your app like...

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

or..

NativeApplication.nativeApplication.addEventListener(BrowserInvokeEvent.BROWSER_INVOKE, onBrowserInvoke);

It doesn't fire on an IOS device, so there's no way to get the parameters out of the arguments property.

The app does indeed fire from a browser if you set up your custom URL scheme properly in your app.xml file.  Framework just doesn't fire the handler function for the registered invoke listener.  The parameter retrieval code at the link below, therefore, doesn't work on an IOS device.

http://www.riaspace.com/2011/08/defining-custom-url-schemes-for-your-air-mobile-applications/

This topic has been closed for replies.

2 replies

New Participant
March 6, 2014

We had a similar problem:

in the invoke-handler we checked for the InvokeEvent.reason to be 'openUrl',

which worked when building the ipa with fast packaging (using IntelliJ IDEA)

but din't work when building with packaging set to   'ipa-ad-hoc' using ANT script (which takes about half an hour for our app).

Solution: in the 'ipa-ad-hoc' mode the InvokeEvent.reason is always 'standard'

in the 'openUrl' case InvokeEvent.arguments contains the url as the first element 

when the app is just started via app-icon the InvokeEvent.arguments is null or an empty list.

Hope that helps anybody who is trying to get this working.

iBr3nt
Inspiring
February 15, 2012

Sorry, I must have done it wrong, because I've successfully retrieved

URL parameters within an AIR iOS app that was launched with a custom URI

scheme from a website on the device.

Posting code shortly...

iBrent

Known Participant
February 15, 2012

Awesome.  Desperate to see that.  Holding up app submission at the moment. 

Participating Frequently
May 3, 2012

Did you get anywhere with this? I'm having the same issue.

Thanks.


I had a reference to an unititialised variable which caused the handler to silently fail, but the app to continue. Android actually managed to work passed this issue, perhaps recalling the handler at a later point in the execution cycle, but either way, once I fixed the issue then parameter handling on iOS works.