问题描述
我正在尝试访问jailbroken iphone中的数据库call_history.db。我可以使用ios 4.1访问iphone 4的call_history.db。但问题是我无法使用ios 3.1.3访问iphone 3gs中的数据库。
I am trying to access database call_history.db in jailbroken iphone. i am able to access call_history.db for iphone 4 with ios 4.1 . But the problem is i am not able to access the database in iphone 3gs with ios 3.1.3.
当我尝试打开3gs数据库时,我收到以下数据库错误:
When i try to open the database for 3gs i get the following database error :
'无法打开数据库文件'
'unable to open database file'
我为ios 4.1和ios 3.1.3使用不同的路径
i use different paths for ios 4.1 and ios 3.1.3
ios 4.1 in iphone 4 - /private/var/wireless/Library/CallHistory/call_history.db
and ios 3.1.3 in iphone 3gs - /private/var/mobile/Library/CallHistory/call_history.db
任何帮助将不胜感激。谢谢。
any help would be greatly appreciated. Thank you.
更新:我按以下方式获取call_history.db
Update : I fetch the call_history.db in the following way
//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);
}
这里的输出是错误:无法打开数据库文件
Here the output is the error : "unable to open Database file"
我注意到我无法通过上述代码访问两个iphone中的Library文件夹。我可以通过ssh手动检索所有文件。
i noticed that i am not able to access the Library folder in both iphones through the above code. I am able to retrieve all the file manually through ssh.
推荐答案
您的应用程序位于沙盒中,无法访问自身以外的任何内容。假设你的目标是越狱设备,这是另一个故事。
Your app is in a sandbox, which is not able to access anything outside of itself. Suppose your targeting jailbroken devices, this is another story.
Xcode会将您的应用安装到沙盒环境中。您需要使用 ldid -S /YourApp.app/YourApp
手动签署应用,然后将其复制到设备 /应用程序
目录。
Xcode will install your app into a sandboxed environment. You need to manually sign the app using ldid -S /YourApp.app/YourApp
then copy it tom the devices /Applications
directory.
这篇关于iphone“无法打开数据库文件” for xcode app中的call_history.db的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!