How to have Xcode find the newest version of a file
- by Arian
Currently I have a SQLite database, that is set statically to use database01.sqlite... but what I need is a way to have the file path find the newest version of the database file that exists.
For example: If a database file of database04.sqlite is available, it should use that one instead.
Below is my current code:
NSString *databaseDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *filePath = [databaseDirectory stringByAppendingPathComponent:@"database01.sqlite"];