Sharing Data Between Apps
All iOS apps are sandboxed, and WatchKit extensions are no different. The unparalleled security this offers means that we need to do a little bit of extra work to allow the WatchKit extension and iPhone app to share data; by default, their sandboxes cannot communicate. To solve this, we’ll create a new App Group, essentially a shared container for file storage for our app. Just like we added the HealthKit capability, head to the TapALap target settings and enable App Groups under Capabilities. Click the + button in the App Groups section to add a new one. We’ll provide a name to Xcode’s Add A New Container dialog box. Much like the bundle ID, this uses reverse DNS-style names as convention, but with group prepended ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access