my iOS application has some json files in its bundle ,, i've updated these files and upload to the store , but when updated the old json files data is still shows up , the only solution i found is to delete the app and install it again but its not a good solution to send to all users
so is there any way to it programtically or any other way
P.S : i tried to change the name of the json files , but its start to crash because the app can't see the path resource of the bundle with the new name here is my code to call these files
{
NSString* aFileName = @"Models.json";
NSString * fileDocumentPath = [NSString stringWithFormat:@"%@/%@", [self getDocumentsDirectoryPath], aFileName];
NSFileManager * fileMngr = [NSFileManager defaultManager];
NSString * file = [aFileName stringByReplacingOccurrencesOfString:@".json" withString:@""];
NSString * sourcePath = [[NSBundle mainBundle] pathForResource:file ofType:@"json"];
NSError *error;
[fileMngr copyItemAtPath:sourcePath toPath:fileDocumentPath error:&error];
}
-(NSString *) getDocumentsDirectoryPath {
NSArray *pathArray = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
documentsDirectoryPath = [pathArray objectAtIndex:0];
return documentsDirectoryPath;
}