I found after configuring my app sandbox, I can not access the preference value.
According the online blog, I have set com.apple.security.files.user-selected.read-write to YES in entitlements. Did I miss something?
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
// Once using sandbox mode, the value is nil.
NSString *value = [defaults objectForKey:@"MyPreference"];
ps: The preference key is correct, because when I close the sandbox, the preference value can be read normally.
Thanks @Gerd K.
In sandboxed app, the user default(
.plist) is stored in/Users/USERNAME/Library/Containers/xiaofeihan.MyWebViewSample/Data/Library/PreferencesIn non-sandboxed app, it is stored in
Users/USERNAME/Library/Preferences