standardUserDefaults aren't shared between the app and extension within the same group
| Originator: | arkadiusz.holko | ||
| Number: | rdar://17360084 | Date Originated: | 17-Jun-2014 12:12 PM |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | iOS 8 beta1 |
| Classification: | Reproducible: |
Summary: In App Extension Programming Guide: Handling Common Scenarios we can read: "NOTE After you enable app groups, an extension and its containing app can both use the NSUserDefaults API to share access to user preferences. For example, a Share extension might update the user’s most recently used sharing account, using code like this: [[NSUserDefaults standardUserDefaults] setObject:theAccountName forKey:@"lastAccountName"]; " This method of sharing doesn't seem to work at the moment. Steps to Reproduce: 1. Create an app with an action extension and use the same group for both of them 2. Set a preference from the app: [[NSUserDefaults standardUserDefaults] setObject:@"test" forKey:@"test"]; 3. Try to access it from the extension: [[NSUserDefaults standardUserDefaults] objectForKey:@"test"]; Expected Results: It should return "test" Actual Results: It returns nil Notes: It's a duplicate of: rdar://17164758
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!