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 ...
Get Developing for Apple Watch now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.