Created
March 2, 2015 11:52
-
-
Save andreamazz/a441cbbf36416d5fc35a to your computer and use it in GitHub Desktop.
NSUserDefaults in Today Extension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// registerDefaults doesn't seem to work when reading from an app extension | |
let userDefaults = NSUserDefaults(suiteName: "group.com.sample.app")! | |
userDefaults.registerDefaults(["SOME_KEY": 1]) | |
userDefaults.synchronize() | |
// In a Today extension: | |
let userDefaults = NSUserDefaults(suiteName: "group.com.sample.app")! | |
println(userDefaults.integerForKey("SOME_KEY")) // prints 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment