NSUserDefault setPersistentDomain:forName: crash issue
NSUserDefault setPersistentDomain:forName: crash issue
- Subject: NSUserDefault setPersistentDomain:forName: crash issue
- From: parth r <email@hidden>
- Date: Fri, 22 Nov 2013 21:58:15 +0530
Hi all,
I am getting a crash as below when i am trying to set the dictionary for
persistent domain.
Attempt to set a non-property-list object as an
NSUserDefaults/CFPreferences value
abort() calledThread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x98cef952 __pthread_kill + 10
1 libsystem_pthread.dylib 0x90852167 pthread_kill + 101
2 libsystem_c.dylib 0x9a783340 abort + 155
3 com.apple.CoreFoundation 0x9b6ad26b -[CFPrefsPlistSource
alreadylocked_setValue:forKey:] + 203
4 com.apple.CoreFoundation 0x9b657ef4 -[CFPrefsSource
alreadylocked_setValues:forKeys:count:] + 68
5 com.apple.CoreFoundation 0x9b7d4f40
___CFXPreferencesReplaceValuesInSourceWithBundleID_block_invoke_2 + 96
6 com.apple.CoreFoundation 0x9b65dd39 +[CFPrefsSource
withSourceForIdentifier:user:byHost:container:perform:] + 969
7 com.apple.CoreFoundation 0x9b7d4ecc
___CFXPreferencesReplaceValuesInSourceWithBundleID_block_invoke + 140
8 com.apple.CoreFoundation 0x9b65754c doSetValuesInSourceWithKVO + 348
9 com.apple.CoreFoundation 0x9b7d4e35 _
CFXPreferencesReplaceValuesInSourceWithBundleID + 101
10 com.apple.Foundation 0x939fc745
-[NSUserDefaults(NSUserDefaults) setPersistentDomain:forName:] + 250
*Scenario*
When user logs in to my application in System Preferences pane, app
receives a few settings from a server which is updated to
NSMutableDictionary.
After updating the dictionary , I set the the values for the domain using
below code,
- (void) saveUserDefaults;
{
[[NSUserDefaults standardUserDefaults]
removePersistentDomainForName:[[NSBundle bundleForClass: [self class]]
bundleIdentifier]];
[[NSUserDefaults standardUserDefaults]
setPersistentDomain:profileDefaults forName:[[NSBundle bundleForClass:[self
class]] bundleIdentifier]];
[[NSUserDefaults standardUserDefaults] synchronize];
}
The issue of crash is not consistently reproducible as well. Please help to
understand as to when this kind of crash can occur ?
thanks,
~PR
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden