Mac OS X 10.11.5: User defaults don't behave well in sandboxed application

Originator:thedov
Number:rdar://27364513 Date Originated:2016-07-14
Status:Open Resolved:
Product:OS X SDK Product Version:10.11.5
Classification:Serious Bug Reproducible:Always
 
Summary:
NSUserDefaults don’t propagate updated settings in a sandboxed application, at least.

Steps to Reproduce:
1. Build and run attached demo app
2. Click “What’s the value?”
3. Click “Set value to ‘a string’ in UTF-8”
4. Click “What’s the value?”
5. Quit
6. Update the com.apple.security.app-sandbox key in UserDefaultsIssue.entitlements to NO
7. Repeat steps 1-4

Expected Results:
2. Label reads “(setting is null)”
4. Label reads “a string”
7. Same behavior

Actual Results:
4. Label still reads “(setting is null)”
7. Works as described above

Notes:
In my actual app, I’m storing an NSURL bookmark, not a UTF-8 string. Also, after quitting my real app and relaunching, step 2 produces the desired result.

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!