Hello everyone I am creating an app that uses a db to show data , but currently the db read it locally via FMDB . What I want to know is how can I download the db directly from a server and display it in the table view ? thank you all sorry for my english ! This is the code I use to read the db locally :`-(void)viewWillAppear:(BOOL)animated{
NSString *path = [[NSBundle mainBundle] pathForResource:@"Climbing" ofType:@"db"];
FMDatabase *db = [FMDatabase databaseWithPath:path];
if (![db open]) {
NSLog(@"Error Opening DB");
return;
}
NSString *queryString;
CDData *regioni;
queryString = @"SELECT * , (SELECT count (*) FROM citta t WHERE t.id_regione = a.id_regione) as city FROM regione a ";
FMResultSet *s = [db executeQuery:queryString];
while ([s next]) {
regioni = [[CDData alloc] initWithRecordSet:s];
[self.data addObject:regioni];
}
[db close];
} `
Aucun commentaire:
Enregistrer un commentaire