mercredi 28 janvier 2015

SQLite Database not working correctly

I'm trying to save some data in an SQLite database in my iOS app. I'm doing this with the method below:



NSString *query = [NSString stringWithFormat:@"INSERT INTO categories VALUES ('%@', '%@', '%@', null, %d)", categoryName, @"test", @"test", 33];

NSLog(@"Query is: %@", query);

[[AFSQLManager sharedManager]performQuery:query withBlock:^(NSArray *row, NSError *error, BOOL finished) {

if (!error) {

if (!finished) {
NSLog(@"No success");
} else {
NSLog(@"Succeeded");
}
} else {

UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"Oops" message:error.description delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
}
}];


As you can see, I'm using AFSQLManager for executing the queries (you can find it here http://ift.tt/1eEl5KR). The method above logs 'succeeded', but when I pull some data from the database, I get no results. My best guess is that it's a problem with the SQLite database....any idea what I'm doing wrong?


Aucun commentaire:

Enregistrer un commentaire