Setting up Wormhole Sharp to Communicate with iOS Extensions

I am adding an Apple Watch app to my latest project and needed a way to communicate with the parent app on the phone. I looked at Wormhole for this type of communication, and I was happy to see that there is a port, appropriately named Wormhole Sharp. Wormhole and Wormhole Sharp use App Groups to create a way for apps to shared data via the iOS file system.

Download and build Wormhole Sharp from here and add a reference to both the parent and extension app projects.

Open the Entitlements.plist in the parent app project and select Enable App Groups. Add a new entry in the App Group section.
Do the same in the extension project and make sure to name the group the same

image of group

Apple requires naming groups by starting with 'group' and then using their common reverse naming style

image from apple dev site

After setting the group in both the extension, and the parent app, go and set the "Custom Entitlements" to the Entitlements.plist for both the parent and extension respectively. Do this by double clicking on the project in the solution pane.

image of entitlements

This is the most critical part, without this it will not work and you will spend a day trying to figure out what is going on.

That's it.

Next we will learn about communicating between App Extensions and the Parent App using Wormhole Sharp. I spent way more time getting this configured to work than I did with setting up back and forth communication.

comments powered by Disqus