任何人都可以帮助我。如何使用WEB API或带有JSON&amp ;;的SERVER API来获取远程数据?然后在iphone中存储到SQLite表中如何做到这一点。对于获取数据我想使用JSON.In SQLite数据库表是user_detailes,其中包含用户名&密码。服务器也有我想要获取的相同数据。 帮助我。
提供一些提示或链接或示例来解决此问题
答案 0 :(得分:0)
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”]) { //在这里使用UIAlertView }