**UPDATE** I have discovered that the database is not opening in the ios device.(only for update?? but it does for a select statement)
It will open in the similator.
I am using FMDB wrapper for SQlite. Everything works fine in the simulator. On the iOS device the database doesn't update.
I download the database like this and save it to this location:
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0]; // Get documents directory
NSString *writableDBPath = [documentsDirectory stringByAppendingPathComponent:@"ARCdb.sqlite"];
[responseData writeToFile:writableDBPath atomically:YES];
NSLog(@"DB written");
[connection cancel];
}
I can read from the database without issue using FMDB but when I try to update it using this code:
//OPEN DB
-(void)openDB
{
NSArray *docPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDir = [docPaths objectAtIndex:0];
NSString *dbPath = [documentsDir stringByAppendingPathComponent:@"ARCdb.sqlite"];
database = [FMDatabase databaseWithPath:dbPath];
[database open];
}
//UPDATE DB
[self openDB];
[database executeUpdate:@"UPDATE inventory SET CompanyID = ?, UserID = ?, Scanned = ?, SignedByName = ?, SignedByFileName = ? where BottleID = ?", customerIDPass, UserIDPass, @"1", signedby, filePath, [bottleIDPassFinal objectAtIndex:a], nil];
}
[database close];
Like I said works in simulator but not on ios device. I am not saving in app bundle so I don't understand.
PLEASE HELP.
Example code would help if needed thank you.