// Add data to favorites for reading and updating
-(Void) replaceCurrentViewData :( NSMutableArray *) array
{
DWUser * loginUser = (AppDelegate *) [UIApplication sharedApplication]. delegate). appUser;
NSMutableDictionary * tempDic = [NSKeyedUnarchiver unarchiveObjectWithData: [NSData dataWithContentsOfFile: [Utils applicationDocumentsDirectory: kCollectFilePath];
[TempDic setObject: array forKey: loginUser. username];
NSData * data = [NSKeyedArchiver archivedDataWithRootObject: tempDic];
[Data writeToFile: [Utils applicationDocumentsDirectory: kCollectFilePath] atomically: YES];
}
Obtain the sandbox path
+ (NSString *) applicationDocumentsDirectory :( NSString *) filename
{
NSArray * paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory,
NSUserDirectory,
YES );
NSString * basePath = ([paths count]> 0 )? [Paths objectAtIndex: 0]: nil;
NSString * appendPath = filename;
Return [basePath stringByAppendingPathComponent: appendPath];
}