Akosha
Akosha

Reputation: 471

Saving sqlite database in cached directory instead of documents

Until now my database was saved in the documents directory of application. Now Apple refuse to do it anymore and I need to change the directory.

Does anyone know how to save a database in cached directory, or even direct me to a tutorial/example.

Upvotes: 1

Views: 506

Answers (1)

trojanfoe
trojanfoe

Reputation: 122391

The caches directory will be the last entry returned from NSSearchPathForDirectoriesInDomains:

NSString *cachesPath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject];
NSString *dbPath = [cachesPath stringByAppendingPathComponent:@"mydatabase.db"];

Upvotes: 2

Related Questions