O'Reilly logo

Developing for Apple Watch by Jeff Kelley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required