I've run into a weird problem with message passing between a custom keyboard app extension and its containing app.
Following this post, I'm setting up a wormhole in both with let wormhole = MMWormhole(applicationGroupIdentifier: "group.com.mytestgroup", optionalDirectory: nil), then I do:
- In the custom keyboard, I trigger sending a message off a keypress. The line I use to send the message is:
self.wormhole.passMessageObject("the message" as NSCoding, identifier: "id1")
- In the containing app, I create a listener with:
self.wormhole.listenForMessage(withIdentifier: "id1", listener: { (message) -> Void in
print("message received")
if let messageFromKeyboard = message as? String {
print(messageFromKeyboard)
}
})
I would expect that after creating the listener in the containing app, a key press in the custom keyboard would cause the listener to get the message and print both "message received" and the actual message to the console. I've confirmed that this happens as expected in the xcode simulator, but it doesn't happen on my iPad...it just fails silently. No error messages....just nothing happens.
Any idea what might be going on here? Is there any problem using MMWormhole for custom keyboards?
Relevant info:
- My iPad is iOS 13.5.1
- Using MMWormhole 2.0.0 installed as a cocoapod
- I saw the troubleshooting suggestion here but at least in my current version of xcode I see no "steps" checkmarks. Just a list of app groups.
- Regardless, I think my app group is set up appropriately, considering the wormhole setup line
let wormhole fails if I change the group id.
- I'm using
wormhole.listenForMessage as opposed to listenForMessageWithIdentifier because I get an error with the latter. Xcode suggested to change it to the former. Similar with the as NSCoding part above. I don't think these tidbits are substantial though, considering things work in sim.
I've run into a weird problem with message passing between a custom keyboard app extension and its containing app.
Following this post, I'm setting up a wormhole in both with
let wormhole = MMWormhole(applicationGroupIdentifier: "group.com.mytestgroup", optionalDirectory: nil), then I do:self.wormhole.passMessageObject("the message" as NSCoding, identifier: "id1")I would expect that after creating the listener in the containing app, a key press in the custom keyboard would cause the listener to get the message and print both "message received" and the actual message to the console. I've confirmed that this happens as expected in the xcode simulator, but it doesn't happen on my iPad...it just fails silently. No error messages....just nothing happens.
Any idea what might be going on here? Is there any problem using MMWormhole for custom keyboards?
Relevant info:
let wormholefails if I change the group id.wormhole.listenForMessageas opposed tolistenForMessageWithIdentifierbecause I get an error with the latter. Xcode suggested to change it to the former. Similar with theas NSCodingpart above. I don't think these tidbits are substantial though, considering things work in sim.