I’m trying to share a
string from my iOS app to my
WatchKit-app. I have enabled
App-Groupsfor both the iOS app and the
extension. Then, in my iOS app, I set a variable for the
let defaults = UserDefaults(suiteName: "group.com.jacobcavin.appName")
Then in the
ViewController, I set
defaults to a string from the text of a TextField.
defaults?.set(textField.text!, forKey: "KEY")
Inside the iOS app, this works perfectly and I can access this and get the right value. But, inside the WatchKit app, I try to get the string.
let defaults = UserDefaults(suiteName: "group.com.jacobcavin.appName") let string = defaults?.string(forKey: "KEY")
returns nil. I’ve looked through tons of tutorials, and I have made sure that each target has the same group identifier, different Bundle Identifiers, and the entitlement .plist files are correct. Can you please help?
Powered by WPeMatico