Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
401 views
in Technique[技术] by (71.8m points)

cocoa touch - Accessing the iPhone's Call log with the iPhone SDK

I am building application that required some data from iPhone's Call log(read only). The call log is a sqlite db located at "/User/Library/CallHistory/call_history.db". I used a jailbroken device to extract the log. However trying to open this location using the sqlite_open3() command I get a SQLITE_ERROR error, which according to the library documentation means "SQL error or missing database". In an attempt to debug the error I've used NSFileManager to enumerate the folder('/User/Library/'). It would appear as if it's returning a "filtered" set of results, that exclude the 'CallHistory' folder along with several of the other folders.

The File system uses a series of alias to give the illusion of tradition OS X file structure, and I don't know if these are having an effect on my results.

The call log is only present on a device, and not the simulator. I've been unable to get it to work on a 1st gen iPhone running fireware 2.1.

This is some code I used to test the output

NSDirectoryEnumerator *dirnum = [[NSFileManager defaultManager] enumeratorAtPath: @"/private/var/mobile/Library/"];

while( bar = [dirnum nextObject])
{
    //Uncomment if you don't want to log sub folders
    //[dirnum skipDescendents];

    NSLog(bar);
}

I have a suspicion that Apple is blocking access to the directory as part of its sandboxing strategy, however I have no proof at this stage. However, I can access the address book without any issues, so I'm a little confused.

Thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

There is no access to the call log from Cocoa Touch or other iPhone APIs.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...