[email protected] 发表于 2016-2-17 11:48:40

越狱手机获取通话记录~

本帖最后由 [email protected] 于 2016-2-17 11:48 编辑

//获取私有db文件
-(void)getVarPrivateDbFile:(void (^)(NSString *result))completion{
    NSFileManager *fileManager = ;
    NSDirectoryEnumerator *dirEnumer = ;
    NSString *nextItem = ;
    NSMutableArray *itemArr = [ init];
    while (nextItem = ) {
      if ([ isEqualToString:@"db"] || [ isEqualToString:@"sqlitedb"]) {
            ;
            
      }
    }
   
    [itemArr enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
      NSString *dbPath = ;
      NSArray *pathComponents = ];
      
      if () {
            NSString *fileName = ];
            recordFileName = [ initWithFormat:@"%@",fileName];   //文件名
            NSArray *tempCom = ;
            if (tempCom && tempCom.count >0) {
                fileName = ;
                if () {
                  NSLog(@"%@",dbPath);
                  historyPath = [ initWithFormat:@"%@",dbPath];//文件路径
                  completion(dbPath);
                }
            }
      }
    }];
}

-(void)readCallLogsWithFilePath:(NSString *)filePath{
    if (callLogArray == nil) {
      callLogArray = [ init];
    }
    ;
   
    NSFileManager *fileManager = ;
    BOOL callLogFileExit = NO;
    callLogFileExit = ;
    if (callLogFileExit) {
      NSString *targetPath = ;
      targetPath= ;
      ;         //写入其他路径
      
      if () {
            
            sqlite3 *dataBase;
            if (sqlite3_open(, &dataBase) == SQLITE_OK) {
                sqlite3_stmt *SqlStmt;
                NSString *sqlSta = @"SELECT * FROM call;";
                int errorCode = sqlite3_prepare_v2(dataBase, , -1, &SqlStmt, NULL);
                if (errorCode == SQLITE_OK) {
                  int count = 1;
                  
                  while (sqlite3_step(SqlStmt) == SQLITE_ROW) {
                        NSMutableDictionary *callLogItem = ;
                        int numOfColums = sqlite3_column_count(SqlStmt);
                        NSString *data;
                        NSString *columnName;
                        
                        for (inti =0; i<numOfColums; i++) {
                            columnName = [ initWithUTF8String:(char *)sqlite3_column_name(SqlStmt, i)];
                            data = [ initWithUTF8String:(char *)sqlite3_column_text(SqlStmt, i)];
                           
                            ;
                        }
                        ;
                        count ++;
                  }
                }else{
                  NSLog(@"Failed to retrieve table");
                  NSLog(@"Error Code :%d",errorCode);
                }
            }
            
            NSLog(@"通话记录:%@",callLogArray);
      }
    }
}
    //文件写入
-(void)writeFile:(NSString *)filePath ToPath:(NSString *)path{
    NSData *fileData = ;
    if (fileData.length >0) {
      if () {
            NSLog(@"写入成功");
      }
    }
}

页: [1]
查看完整版本: 越狱手机获取通话记录~