Dhaval
Dhaval

Reputation: 168

How to get call history from iphone?

I try with following code but i can't access it.

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

NSLog(@"DirectoryAttributes:%@",[dirnum directoryAttributes]);

Response result :

"DirectoryAttributes:{
NSFileCreationDate = "2008-01-01 05:38:41 GMT";
NSFileExtensionHidden = 0;
NSFileGroupOwnerAccountID = 501;
NSFileGroupOwnerAccountName = mobile;
NSFileModificationDate = "2011-07-29 11:38:10 GMT";
NSFileOwnerAccountID = 501;
NSFileOwnerAccountName = mobile;
NSFilePosixPermissions = 493;
NSFileReferenceCount = 26;
NSFileSize = 986;
NSFileSystemFileNumber = 43;
NSFileSystemNumber = 234881026;
NSFileType = NSFileTypeDirectory;
}"

help me to Access call_history.db data table.

Thanks.

Upvotes: 2

Views: 7345

Answers (2)

saadnib
saadnib

Reputation: 11145

You can get as -

BOOL callhistoryfileexist = FALSE;

NSFileManager *fileManager = [NSFileManager defaultManager];


callhistoryfileexist = [fileManager fileExistsAtPath:@"/private/var/wireless/Library/CallHistory/call_history.db"];

[fileManager release];

if(callhistoryfileexist)
{
    //copy it where you want it
}

Note : not valid in iOS 5

Upvotes: 0

Suhail Patel
Suhail Patel

Reputation: 13694

Your application is Sandboxed so you can't access any directories outside your App directory. There are no Cocoa Touch or Objective C API's to access the Call Log

Upvotes: 5

Related Questions