0
votes

I am trying to pass data from my iPhone app to my Apple Watch app. I already have a working today extension widget (not sure if that requires app groups) but I cannot get the Apple Watch to read NSUserDefaults.

SET

let defaults:NSUserDefaults = NSUserDefaults(suiteName: "group.com.mySuite")

defaults.setObject(dates, forKey: "allDates")

RETRIEVE

var theDates = defaults.arrayForKey("allDates")

Nothing is crashing, but the NSUserDefaults call returns nil. Any suggestions?

1
What kind of object is dates? Try objectForKey.Arun Gupta
That does not work..Matt Butler

1 Answers

0
votes

WatchOS 2 requires a different method of transferring data between the iPhone and the Apple Watch.

See it here