Trouble using NSKeyedArchiver in place of NSUserDefaults

I’m working on a code wherein there is a requirement for saving and using a default coordinate every time there is updation of location. I have used 2 kinds of defaults- one under the application domain, the other under register-domain (default settings for first time app-launch). Now, what i want to have happen, is to use NSKeyedArchiver for storing the coordinate data and NSKeyedUnarchiver for reading the coordinate data. Both the values- latitude and longitude, are to be stored under one key. Here is my viewcontroller-



When i used NSKeyedUnarchiver to unarchive the contents of the serialized data, the [NSKeyedUnarchiver unarchiveObjectWithData:serializedData] message returned nil. I used a local object-var “d” to assign the returning value to, though i’d had the coordinateData have the return-value assigned to, initially. Therefore, the coordinateData used to get updated to ‘nil’. I don’t know what to do. Should you need the console output or more code for getting more context, I’ll add the link to it. Any useful direction or suggestion that can help me solve this issue would be welcome.

This topic was automatically closed after 166 days. New replies are no longer allowed.