如何从iphone获取通话记录?

时间:2011-08-09 13:27:48

标签: iphone ios

我尝试使用以下代码但我无法访问它。

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

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

回应结果:

  

“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;
  }“

帮我查看call_history.db数据表。

感谢。

2 个答案:

答案 0 :(得分:5)

您的应用程序是沙盒,因此您无法访问App目录之外的任何目录。没有Cocoa Touch或Objective C API来访问呼叫记录

答案 1 :(得分:0)

你可以得到 -

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
}

注意:在iOS 5中无效