Frustration on the Top !!!
I am getting some JSON Response from the Service and I want to store it in the .plist file for Future Reference.
I am unable to save my JSON Response to .plist File. I think it's due to some null
values into the Response.
Note : I confirmed that the Response is in JSON Format using jsonparser.
My Code :
NSError *error;
NSDictionary* json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
NSDictionary *dictResult = [(NSDictionary*)json objectForKey:@"myKey"];
NSLog(@"Result Dictionary :: %@",dictResult);
NSURL *cacheDir = [[[NSFileManager defaultManager] URLsForDirectory:NSCachesDirectory inDomains:NSUserDomainMask] lastObject];
NSURL *path = [cacheDir URLByAppendingPathComponent:@"FinalResult.plist"];
NSLog(@"Path :: %@",path);
BOOL success = [dictResult writeToURL:path atomically:YES];
NSLog(@"success? %d", success);
Note : I got all the NSLog Values (means the Response Dictionary and File Path but 0 for success).
Problem : There are almost 70-80 key-value pairs in the Response and I don't want to remove/replace all the null
values. Because What I want is ...
- GET the Response From the Server.
- Fill all the UITextFields with the Response.
- POST the Same Response to the Server with some Edited Values from the UITextFields.
So, I just want to change the Edited UITextField
values in the Object and let it POST to the Server.
What is the Optimum Way to Fix this ?