【发布时间】:2011-07-26 18:41:32
【问题描述】:
我正在尝试访问越狱 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 使用不同的路径
iPhone 4 中的 iOS 4.1 - /private/var/wireless/Library/CallHistory/call_history.db
iPhone 3gs 中的 iOS 3.1.3 - /private/var/mobile/Library/CallHistory/call_history.db
更新
我通过以下方式获取 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);
}
这里的输出是错误:
无法打开数据库文件
我注意到我无法通过上述代码访问两部 iPhone 中的 Library 文件夹。我可以通过 ssh 手动检索所有文件。
【问题讨论】:
-
我还检查了 sms.db 文件。在 iphone 4 中,我能够访问位于 /private/var/wireless/Library/CallHistory/call_history.db 的 call_history.db 文件,但我无法访问位于 /private/var/mobile 的 sms.db /图书馆/短信/短信.db。所以我认为这可能与文件位置有关。但我不确定她发生了什么。有人可以帮忙吗
-
我注意到我无法通过编码访问 /private/var/mobile/Library 文件夹。我还检查了移动/图书馆文件夹的权限,它与无线/图书馆文件夹相同。然后它也无法访问。有没有人有这个想法????
-
分享一些你正在使用的代码。因为如果你的手机越狱了,你应该可以正常访问目录。
-
@WrightsCS:我已经用代码编辑了我的问题。我使用简单的 sqlite_open 语句打开数据库文件。它适用于带有无线文件夹的 ios 4,但不适用于 call_history.db 位于 Library 文件夹中的 ios 3.1.3。
-
看起来 sms.db 的 UNIX 所有者是“移动的”,而 call_history.db 的所有者是“无线的”。也许这与它有关?