I added App Groups to my app ID in the developer portal and am using that App ID in my provisioning profile. My Product Identifier in Xcode is set to that app ID.
In my app delegate I call this from didFinishLaunchingWithOptions
NSUserDefaults.standardUserDefaults().setObject("hey", forKey: "TEST")
NSUserDefaults.standardUserDefaults().synchronize()
In my keyboard app extension I call this:
if let test = NSUserDefaults.standardUserDefaults().objectForKey("TEST") as? String
{
println(test)
}
This never is true. If I remove the validation test and just print the result the custom keyboard crashes.
EDIT Have also tried this with same crash result:
App Delegate
var userDefaults = NSUserDefaults(suiteName: "group.jackedgames.myappgroup")
userDefaults.setObject("TEST", forKey: "TEST")
userDefaults.synchronize()
Keyboard Extension
var userDefaults = NSUserDefaults(suiteName: "group.jackedgames.myappgroup")
var test = userDefaults.objectForKey("TEST") as String
NSLog(test)
In the "Capabilities" section of both targets I have the groups enabled with this group ID selected.
What am I missing here?