使用SQLite3部署iPhone App

时间:2011-02-23 06:20:52

标签: iphone ipad ios deployment sqlite

我有一个包含SQLite3数据库的iPhone应用程序(2-3个表)。当我在模拟器上构建它时,它工作正常,但在iPhone设备上部署它时会发出弹出消息 - “数据库错误 - 打开数据库失败.Hrm” 在Consol中它显示:

警告:无法读取/Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1(8C148)/Symbols/usr/lib/info/dns.so(未找到文件)的符号。

需要帮助(因为我是iPhone应用程序和SQLite3的新手) 代码:

int result;
result=sqlite3_open("/Users/saggezza/Desktop/TimeTrackerApp/login.db",&database);

- (IBAction为)button_login {

sqlite3_exec(database, "CREATE TABLE IF NOT EXISTS login(ID INTEGER PRIMARY KEY AUTOINCREMENT, Username varchar,Password varchar,Name Text)",
             NULL, NULL, NULL);





int ret = sqlite3_step(statement);
sqlite3_reset(statement);
if (ret == SQLITE_DONE) 
{
    sqlite3_finalize(statement);
    sqlite3_close(database);

}


const char *sqlStatement1= "select * from login";
sqlite3_prepare_v2(database, sqlStatement1, -1, &statement,nil);

while (sqlite3_step(statement)==SQLITE_ROW)
{

    NSString *uname=[[NSString alloc]initWithUTF8String:(char *)sqlite3_column_text(statement, 1)];
    NSString *pwd=[[NSString alloc]initWithUTF8String:(char *)sqlite3_column_text(statement, 2)]; 

    ename =[[NSString alloc]initWithUTF8String:(char *)sqlite3_column_text(statement, 3)]; 



    if ([(textField1.text) isEqualToString:uname] && [(textField2.text) isEqualToString:pwd])
    {



        TimeTrackerAppAppDelegate *timeTracker=(TimeTrackerAppAppDelegate *)[[ UIApplication sharedApplication] delegate];

         Mainpage *sView = [[Mainpage alloc] initWithNibName:@"Mainpage" bundle:nil ];
         timeTracker.name=ename;

         [self.navigationController pushViewController:sView animated:YES];
        // [self presentModalViewController:sView animated:YES];

        return;
    }


}

谢谢!

1 个答案:

答案 0 :(得分:0)

由于您尚未发布任何代码,因此有点难以回答您的具体问题。但您可能会发现此tutorial有用。它也适用于我的设备。