iPhone“无法打开数据库文件"用于Xcode应用程序中的call_history.db [英] iPhone "unable to open database file" for call_history.db in xcode app
问题描述
我试图在越狱的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
-
iPhone 4中的iOS 4.1-/private/var/wireless/Library/CallHistory/call_history.db
iOS 4.1 in iPhone 4 - /private/var/wireless/Library/CallHistory/call_history.db
和iOS 3.1.3-/private/var/mobile/Library/CallHistory/call_history.db
and iOS 3.1.3 in iPhone 3gs - /private/var/mobile/Library/CallHistory/call_history.db
我通过以下方式获取call_history.db
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);
}
在这里输出错误:
无法打开数据库文件
unable to open Database file
我注意到我无法通过上述代码访问两部iPhone的Library文件夹.我能够通过ssh手动检索所有文件.
I noticed that I am not able to access the Library folder in both iPhone's 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
手动对应用进行签名,然后将其复制到设备的/Applications
目录中.
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“无法打开数据库文件"用于Xcode应用程序中的call_history.db的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!