I'm using FMDB to work with SQLite on my latest iOS project (supports iOS SDK 7.0 & above). Everything is working like a charm during development & I love this wrapper. I've tested on simulator & directly build to device (my device is iPhone 5C & iPad mini 2), no problems happened.
But things go down when I distribute an Ad-hoc build (using my developer certificate & provisioning) via TestFlight to my testers. They can download & install my app successfully but when it launch, an 'out of memory' error thrown out the screen.
I've checked some other SO questions & made sure every FMResultSet *
is closed after used. But when I use iTools to explore the app's directory structure, surprisingly no database file was created, which mean FMDB can't open the SQLite database file and throw out the misleading 'out of memory' error. So what I've tried with the creation of database file:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *appBundleName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
NSString *dbPath = [paths[0] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.sqlite", appBundleName]];
_database = [FMDatabase databaseWithPath:dbPath];
<- what create foo-bar.sqlite inside the app's Documents folder
NSString *appBundleName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
_database = [FMDatabase databaseWithPath:[NSString stringWithFormat:@"/tmp/%@.sqlite", appBundleName]];
<- what create foo-bar.sqlite inside the tmp
folder
_database = [FMDatabase databaseWithPath:@"/tmp/tmp.db"]];
<- what is exactly what FMDB tutorial shows
But no lucks. The .sqlite
/.db
file is still not created.
Anyone has faced this problem before or any suggestions to help me out of this stuck?
Thanks in advanced.