Can any one help me .How can a fetch the remote data using WEB API's or SERVER API's with of JSON & then store into SQLite table in iphone how can do this .For fetching data I want to use JSON.In SQLite database table is user_detailes which ha开发者_运维技巧s username & password .And the server also has the same data which i want fetch. Help me to this.
Give some hints or links or sample to solve this
NSString * txtUsername = @"";
NSString * txtPassword = @"";
sqlite3 *database;
NSString *sqlStatement = @"";
if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK)
{
sqlStatement = [NSString stringWithString:@"select * from account_info "];
NSLog(@"%@",sqlStatement);
sqlite3_stmt *compiledStatement;
if(sqlite3_prepare_v2(database, [sqlStatement cStringUsingEncoding:NSUTF8StringEncoding], -1, &compiledStatement, NULL) == SQLITE_OK)
{
while(sqlite3_step(compiledStatement) == SQLITE_ROW)
{
txtUsername = [[NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 1)] retain];
txtPassword = [[NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 2)] retain];
}
}
sqlite3_finalize(compiledStatement);
sqlite3_close(database);
if(txtUsername isEqulaToString:@"user1"]) { //use UIAlertView here }
精彩评论