I really don't know how to approach this. I'm creating a keyboard extension and I need to share some data between my application and my plugin. I'm trying to use NSUserDefaults.
I have the following snippet in my application
userDefaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.com.____"];
[userDefaults setObject:@"w/e" forKey:@"mykey"]; //in my app
[userDefaults stringForKey:@"mykey"]; //in my extension
I have created the group ID in itunes connect, updated the application ID for both the app and the extension, I have recreated the provisioning profile and I have add the following entitlements
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.application-groups</key>
<array>
<string>group.com.___</string>
</array>
</dict>
</plist>
everything works great... on the simulator. when I access myKey
running the plugin from the device I get a nil object back.
not that, the object userDefaults
it self is not nil.
any help?
EDIT the problem doesn't seem to show up if I ask and grand full-access to the plugin. but why would I need full-access to use this functionality? and why do I need it on the device and not on the simulator?