2

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.

Joe
  • 56,979
  • 9
  • 128
  • 135
Dhaval
  • 168
  • 2
  • 12
  • possible duplicate of [iphone "unable to open database file" for call_history.db in xcode app](http://stackoverflow.com/questions/5498291/iphone-unable-to-open-database-file-for-call-history-db-in-xcode-app) – Brad Larson Aug 09 '11 at 14:24
  • See also [iPhone call log / history](http://stackoverflow.com/questions/6214725/iphone-call-log-history) and [Accessing call log history in iphone](http://stackoverflow.com/questions/3615240/accessing-call-log-history-in-iphone) – Brad Larson Aug 09 '11 at 14:28

2 Answers2

5

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

Suhail Patel
  • 13,644
  • 2
  • 44
  • 49
0

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

saadnib
  • 11,145
  • 2
  • 33
  • 54