Thanks to everyone for the help.  I’m pretty sure about this Graham but I will 
take one last look.  Problem is I’m never able to reproduce this issue and as I 
mentioned this is happening to a very small percentage of users which would 
seem to mean it’s not my code (???).  It’s just trying to figure out what is 
different about their cases that is causing me trouble…

Regarding the lock files maybe the next time I get this reported I can inquire 
about this…

And about not relying on the .plist if we don’t rely upon it how do we write 
our prefs?  I understand I should not manipulate it directly, but I am calling 
everything via NSUserDefaults…

rc



On Sep 10, 2014, at 2:14 PM, Graham Cox <graham....@bigpond.com> wrote:

> 
> On 10 Sep 2014, at 3:43 pm, Rick C. <rickcort...@gmail.com> wrote:
> 
>> Thanks for the help.  So I have double-checked and the info in question that 
>> is not sticking is NSString/NSData being written:
>> 
>> [[NSUserDefaults standardUserDefaults] setObject:stringObject 
>> forKey:@“MyStringKey”];
>> [[NSUserDefaults standardUserDefaults] setObject:dataObject 
>> forKey:@“MyDataKey”];
>> 
>> Then being read:
>> 
>> NSString *myStringObject = [[NSUserDefaults standardUserDefaults] 
>> stringForKey:@“MyStringKey"];
>> NSData *myDataObject = [[NSUserDefaults standardUserDefaults] 
>> dataForKey:@“MyDataKey”];
>> 
>> I am not manipulating my .plist in any other way only using NSUserDefaults
> 
> 
> That should definitely work.
> 
> Are you certain something else somewhere isn't using the same key to change 
> the setting? Is it possible that the object passed to -setObject:forKey: 
> isn't a NSString or NSData? The named getter methods also check the type - 
> does it work if you use -objectForKey: instead? Try logging the objects, it's 
> probably something you didn't expect.
> 
> 
>> Are you calling synchronise too when you're writing?
> 
> That isn't needed. It used to flush the defaults to disk but it no longer 
> does anything AFAIK. It was never needed within a single app session, and was 
> invoked automatically on quit.
> 
> --Graham
> 
> 


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to