views:

16

answers:

0

I have a Mutable Array of objects, NSStrings, NSArrays, NSDictionaries, NSNumbers. These I archive this array and add it to NSUserDefaults without any problem, however when I call synchronize the method returns NO.

Code:

[[NSUserDefaults standardUserDefaults] setObject:[NSKeyedArchiver archivedDataWithRootObject:statusUpdates] forKey:thisFriend.fbuid];    

BOOL synchronized = [[NSUserDefaults standardUserDefaults] synchronize];

NSLog(@"defaults synchronized: %d", synchronized);

The data can be retrieved from NSUserDefaults as long as I don't terminate the app, but since it does not synchronize it is not available on re-launch.

Note: this post suggests that the problem is a result of attempting to save nil values, but since I turn it into archived data that should not be a problem. If this indeed is the problem as solution for writing, checking for, and retrieving the data from a file would also be accepted (currently I get an error while checking for the existence of the file on first run before it has been written).