we can share data between iphone and Apple Watch via app groups. Here's how:
The first thing to do is add a new app group to Dev Center:
Next, create a new single view application, named Sharingdatademo:
Add three controls to the main interface: TextField, button, and label.
Use Nsuserdefaults to save user-entered content in a button's Click event:
Note Suitename must match the identifier ID of the app group defined in Dev Center.
Next add Watch: Select the File-new-target-watchkit App:
Add two controls to watch's main interface: Label and button.
Use Nsuserdefaults in the Click event of a button to read the data saved in the previous step and display it on the label:
The final step, and the key step, is to set up the iphone app and watch app to the same group, which is missing and the data cannot be shared.
Note that the iphone app and watch app are set up so that you don't miss the Watch app settings.
Effect:
IOS: Share data App Groups between iphone and Apple Watch