I tried to send data from iPhone app to watch kit extension but fail. And have no idea how to do it.
I tested on simulator and send data via app groups.
Here is my steps:
- download watch kit catalog sample app from apple
- Add App groups (XXX.XXX.XXX) for iPhone app and wtach kit extension
- Add RequestOpenAccess: YES for NSExtensionAttributes (watch kit extension)
- Add a button to iPhone app that will write a value to NSUserDefaults with the specific Suite Name
Add code at watchkit extension to read NSUserDefaults data. ([NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:)
Run watch kit app
- manual click the Catalog app in the iPhone simulator
- click the button added at step 4
- add break point at watchkit extension to see if the NSUserDefaults value changed
- Nothing happen
What necessary things I miss?
Or I should use another way to do this?
All I want to do is to send data from iPhone to watch every seconds. The data could be string or image.
Thanks