i am trying to save a mutable array into a file with the help of following code
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *ArrayFileName = [documentsDirectory stringByAppendingPathComponent:@"ex.dat"];
[Array writeToFile:ArrayFileName atomically:YES];
but i want to save the array with a timestamp so that i can retrieve it later accordingly. I am not sure how to create or apply a timestamp to the array and how to retrieve it. any help would be appreciated??
Make a
NSDictionarywith theArrayand timestamp as members and @”array” and @”timestamp” as keys. Write theNSDictionaryto the file similar to the way you have done it forNSArray.Similarly, after retrieving the
NSDictionaryfrom the file, you can get theNSArrayand timestampusing