iphone"无法打开数据库文件",用于xcode应用程序中的call_history.db

Jay*_*ree 1 sqlite iphone jailbreak

我试图在越狱的iPhone中访问数据库call_history.db.我可以使用ios 4.1访问iphone 4的call_history.db.但问题是我无法使用ios 3.1.3访问iphone 3gs中的数据库.

当我尝试打开3gs数据库时,我得到以下数据库错误:

'无法打开数据库文件'

我为ios 4.1和ios 3.1.3使用不同的路径

//NSString *path=@"/private/var/wireless/Library/CallHistory/call_history.db";//for ios 4.0 and above call_history.db
 NSString *path=@"/var/mobile/Library/CallHistory/call_history.db";//for ios 3.0 and above call_history.db

if(sqlite3_open([path UTF8String], &database) == SQLITE_OK)
{
   //code for fetching the calls goes here.////

    NSLog(@"call_history present");
}

else {

    NSLog(@"Failed to open database with message '%s'.", sqlite3_errmsg(database));
    sqlite3_close(database);
}
Run Code Online (Sandbox Code Playgroud)

任何帮助将不胜感激.谢谢.

更新:我以下列方式获取call_history.db

//NSString *path=@"/private/var/wireless/Library/CallHistory/call_history.db";//for ios 4.0 and above call_history.db
 NSString *path=@"/var/mobile/Library/CallHistory/call_history.db";//for ios 3.0 and above call_history.db

if(sqlite3_open([path UTF8String], &database) == SQLITE_OK)
{
   //code for fetching the calls goes here.////

    NSLog(@"call_history present");
}

else {

    NSLog(@"Failed to open database with message '%s'.", sqlite3_errmsg(database));
    sqlite3_close(database);
}
Run Code Online (Sandbox Code Playgroud)

这里的输出是错误:"无法打开数据库文件"

我注意到我无法通过上面的代码访问两个iphone中的Library文件夹.我可以通过ssh手动检索所有文件.

Wri*_*sCS 5

您的应用位于沙箱中,无法访问其他任何内容.假设你的目标是越狱设备,这是另一个故事.

Xcode会将您的应用安装到沙盒环境中.您需要手动对应用程序进行签名,ldid -S /YourApp.app/YourApp然后将其复制到设备/Applications目录中.