Your JavaScript won’t be interpreted by iOS Extension least it won’t be by default. But you realise that several miserable hours later.

First things first. I am developing iOS Action Extension that can communicate to part of native app via simple interface provided by platform. There is a very neat tutorial for this. You follow it and burn.

Going through tutorial step-by-step with different result

The JavaScript you have provided is perfectly fine, but native app always gets empty dictionary on input. You are hopeless and thinking about good times on Android… hell no! The whole problem lays (and this is not mentioned on any tutorial worldwide) in idiotically configured Build Phase (yes, XCode takes care of that).

All JavaScript files are treated as Compile Sources (which is not good as you probably imagine). Taking it away and adding to Copy Bundle Resources solves the whole mystery. From now on, your extension talks to app and vice versa. You’ve just saved 3 hours of lamentation and googling. I had no such luck.

Your XCode looks like this? You’re safe.

You can set it also in AppCode (like many people of wisdom do these days). Here it comes:

Wow! Same config but in stylish grey. You NEED this!

This misconfiguration will trick you also when trying to feed WebView with bundled scripts.

Do not feed compiler with scripts and everyone is happy!