It seems executeScript is not always being called on devices, but always called on emulators. The script executes maybe every other time. But it's never even that consistent. Listener is added every time correctly. Works consistently on Android. Possibly related to the strange behavior others are seeing with WKWebView?
Here's the code:
Both the emulator and iPhone are using iOS 9.3.4. I'm at a loss for what's different about the emulator environment compared to the iPhone environment that could cause this.