Are you calling synchronise too when you're writing?

[[NSUserDefault standardUserDefaults] synchronise]



Verstuurd vanaf mijn iPhone

> Op 10 sep. 2014 om 07:43 heeft "Rick C." <rickcort...@gmail.com> het volgende 
> geschreven:
> 
> 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.  
> I am aware of the caching issues that started in Mavericks, but if we can’t 
> read/write using NSUserDefaults how else can we do it?  Also, when I say not 
> sticking this could be from day to day so I would expect the cache to be 
> updated in that amount of time.  What else can I do here or what am I doing 
> wrong???
> 
> 
> 
>> On Sep 9, 2014, at 2:08 PM, Graham Cox <graham....@bigpond.com> wrote:
>> 
>> 
>>> On 9 Sep 2014, at 3:36 pm, Rick C. <rickcort...@gmail.com> wrote:
>>> 
>>> I write some data to my .plist using standard NSUserDefaults
>> 
>> 
>> Are you writing the .plist file, or are you using the NSUserDefaults object 
>> exclusively? From 10.9 the .plist isn't updated by NSUserDefaults, so values 
>> there can be very much out of date, because the defaults system caches its 
>> contents.
>> 
>> You can't rely on the plist being an accurate representation of what the 
>> user defaults actually contains.
>> 
>> --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/diederik%40tenhorses.com
> 
> This email sent to diede...@tenhorses.com

_______________________________________________

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