简体   繁体   English

使用SQLite3部署iPhone App

[英]Deploying iPhone App with SQLite3

I have an iPhone App which contains SQLite3 database(2-3 tables). 我有一个包含SQLite3数据库(2-3个表)的iPhone应用程序。 When I am building it on Simulator it's working fine but while deploying it on iPhone Device it's giving an Pop-Up Message - "Database Error-Failed to Open Database. Hrm" While in Consol it's showing : 当我在Simulator上构建它时,它可以正常工作,但是在iPhone设备上部署它时,它会弹出消息-“数据库错误无法打开数据库。Hrm”在Consol中显示:

Warning : Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148)/Symbols/usr/lib/info/dns.so (file not found). 警告:无法读取/Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1(8C148)/Symbols/usr/lib/info/dns.so的符号(找不到文件)。

Need help (As I am new to iPhone Apps and SQLite3) Code : 需要帮助(因为我是iPhone Apps和SQLite3的新手)代码:

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

-(IBAction)button_login { -(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;
    }


}

Thanks ! 谢谢 !

Since you have not posted any code, its a little difficult to answer your specific problem. 由于您尚未发布任何代码,因此很难回答您的特定问题。 But you may find this tutorial helpful. 但是您可能会发现本教程很有帮助。 It worked for me on device as well. 它也适用于我的设备。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM