2012-03-16 27 views
5

Tôi đang làm việc trên một ứng dụng cần đọc các số liên lạc từ SIM. Tôi biết rằng không thể sử dụng Apple SDK chính thức. Tôi đang phát triển ứng dụng này cho iPhone đã bẻ khóa.Đọc các số liên lạc trên SIM trong jailbroken iPhone

Tôi đã tìm kiếm rất nhiều nhưng câu trả lời duy nhất tôi nhận được là KHÔNG THỂ.

Bất kỳ trợ giúp nào đối với đường dẫn sẽ thực sự được đánh giá cao.

+0

Tôi đoán bạn không thấy từ "bẻ khóa" trong câu hỏi .. –

+0

Bây giờ nó sẽ được hiển thị :) hy vọng bạn sẽ nhận được một số câu trả lời. –

+0

công việc thông minh @rokjarc .. Cảm ơn :) –

Trả lời

1
NSString *addressbookDatabasePath = @"/private/var/wireless/Library/AddressBook/addressbook.db"; 
addressbookFileExist = [fileManager fileExistsAtPath:addressbookDatabasePath]; 
[fileManager release]; 
NSMutableArray *addressbook = [[NSMutableArray alloc] init]; 

if(addressbookFileExist) { 
if ([fileManager isReadableFileAtPath:addressbookDatabasePath]) { 
    sqlite3 *database; 
    if(sqlite3_open([addressbookDatabasePath UTF8String], &database) == SQLITE_OK) { 
     sqlite3_stmt *compiledStatement; 
     NSString *sqlStatement = [NSString stringWithString:@"SELECT * FROM call;"]; 

     int errorCode = sqlite3_prepare_v2(database, [sqlStatement UTF8String], -1, 
              &compiledStatement, NULL); 
     if(errorCode == SQLITE_OK) { 
      int count = 1; 

      while(sqlite3_step(compiledStatement) == SQLITE_ROW) { 
       // Read the data from the result row 
       NSMutableDictionary *addressbookItem = [[NSMutableDictionary alloc] init]; 
       int numberOfColumns = sqlite3_column_count(compiledStatement); 
       NSString *data; 
       NSString *columnName; 

       for (int i = 0; i < numberOfColumns; i++) { 
        columnName = [[NSString alloc] initWithUTF8String: 
           (char *)sqlite3_column_name(compiledStatement, i)]; 
        data = [[NSString alloc] initWithUTF8String: 
          (char *)sqlite3_column_text(compiledStatement, i)]; 

        [addressbookItem setObject:data forKey:columnName]; 

        [columnName release]; 
        [data release]; 
       } 
       [callHistory addObject:callHistoryItem]; 
       [callHistoryItem release]; 
       count++; 
      } 
     } 
     else { 
      NSLog(@"Failed to retrieve table"); 
      NSLog(@"Error Code: %d", errorCode); 
     } 
     sqlite3_finalize(compiledStatement); 
    } 
} 
} 
+1

Điều đó có hiệu quả? Không bao giờ nhận thấy thư mục/private/var/wireless. – fbernardo

Các vấn đề liên quan