iPhone db文件组织结构

iPhone Database Details

I’m a digital (as well as physical) packrat. I have all my emails going back to 1994, most of the documents I’ve created in that time (as many as allowed by my previous employers) and a whole collection of IMs. The text messaging on my phone has always been a missing bit of data - until now there’s been no good way to get it off of my phone.

As details have emerged on the iPhone’s internal data structures, I realized that there might be a chance to extract those text messages and archive them offline. Also looks like voicemails can be archived in a similar fashion. I’m almost ready to share the utility with the world, but until then I thought I’d share my iPhone database structure notes. For those geeks interested in such matters, click through to the extended entry. (Thanks to Erica Sadun for porting sqlite3 to the iPhone - made this whole thing much easier)

SMS DB
/private/var/root/Library/SMS/sms.db

TABLE_SqliteDatabaseProperties 
 key (TEXT)value (TEXT)
 _ClientVersion2
 _UniqueIdentifierGUID
TABLEmessage 
 ROWID (INTEGER PRIMARY KEY AUTOINCREMENT)
 Auto-incrementing field/counter
 address (TEXT)
 International-formatted foreign address
 (18005551212)
 date (INTEGER)
 OSX-epoch based datetime, convertable via date -r
 (1187200801)
 text (TEXT)
 Content of text message
 (This is the text message)
 flags (INTEGER)
 Flags controlling the type of record
 2 - Message sent from address to iPhone
 3 - Message sent from iPhone to address
 129 - Message log erased from iPhone but addressee still in SMS index
 replace (INTEGER)
 Unknown, always 0 in my case
 svc_center (TEXT)
 service center, seems null in my case

CallData DB
/System/Library/Frameworks/AppSupport.framework/calldata.db

TABLE_SqliteDatabaseProperties
TABLEcitycode 
 code (INTEGER)
 Not sure what the significance of these entries are, I’m wondering if they have something to do with the geocoding of calls not made from your phonebook?
 (3888)
 city (TEXT)
 Not sure what the significance of these entries are, I’m wondering if they have something to do with the geocoding of calls not made from your phonebook?
 (RED CLOUD)
INDEXcitycode_codeIndex
 citycode (code)
TABLEnpa 
 npa (TEXT)
 Numbering Plan Area, aka Area Code
 (415)
 location (TEXT)
 State/Province Assigned to the NPA
 (CA)
 country (TEXT)
 Country Assigned to the NPA, may be null if “location” is specific enough
 (USA)
TABLEnpalocation 
 npa (TEXT)
 Numbering Plan Area, aka Area Code
 (415)
 location (TEXT)
 Descriptive location info
 (San Francisco/North Bay Area)
TABLEnpanxx 
 npa (INTEGER)
 Numbering Plan Area, aka Area Code
 (907)
 nxx (INTEGER)
 Unknown
 (200)
 rate_center (INTEGER)
 Unknown
 (1)
INDEXnpanxx_npanxxIndex
 npanxx (npa,nxx)

CallHistory DB
/private/var/root/Library/CallHistory/call_history.db

TABLE_SqliteDatabaseProperties 
 your values will certainly be different here…when you “restore” your iPhone from iTunes the counters all reset
 key (TEXT)value (TEXT)
 call_history_limit100
 timer_last60
 timer_outgoing900
 timer_incoming540
 timer_all1440
 timer_lifetime1440
 timer_last_reset
 data_up_last2.5439454125
 data_down_last20.86328125
 data_up_all719.9228515625
 data_down_all8677.8427734375
 data_up_lifetime719.9228515625
 data_down_lifetime8677.8427734375
 data_last_reset
 _ClientVersion3
 _UniqueIdentifierGUID
TABLEcall 
 ROWID (INTEGER PRIMARY KEY AUTOINCREMENT)
 Auto-incrementing field/counter
 address (TEXT)
 International-formatted foreign address
 (18005551212)
 date (INTEGER)
 OSX-epoch based datetime, convertable via date -r
 (1187200801)
 duration (INTEGER)
 Length of call in seconds rounded to next minute, 0 = missed call
 (60)
 flags (INTEGER)
 Flags controlling the type of record
 5 - Outgoing call
 4 - Incoming call
 id (INTEGER)
 AddressBook ID for outgoing calls selected from AddressBook, otherwise -1
 (67)
INDEXdate_index
 call (date)

KeyChain DB
/private/var/root/Library/Keychains/keychain-2.db
Encrypted, I don’t know how to parse this yet

Notes DB
/private/var/root/Library/Notes/notes.db

TABLE_SqliteDatabaseProperties 
 key (TEXT)value (TEXT)
 _ClientVersion2
 _UniqueIdentifierGUID
TABLENote 
 creation_date (INTEGER)
 title (TEXT)
 summary (TEXT)
TABLEnote_bodies 
 note_id (INTEGER UNIQUE)
 data

Voicemail DB
/private/var/root/Library/Voicemail/voicemail.db

TABLE_SqliteDatabaseProperties 
 key (TEXT)value (TEXT)
 VMVersion4
 _UniqueIdentifierGUID
 tokenstring containing various values, including your phone number
 uid_validity1183172695
 mailboxusage57
TABLEvoicemail 
 ROWID (INTEGER PRIMARY KEY AUTOINCREMENT)
 Auto-incrementing field/counter
 remote_uid (INTEGER)
 International-formatted foreign address
 (18005551212)
 date (INTEGER)
 OSX-epoch based datetime, convertable via date -r
 (1187200801)
 token (TEXT)
 Always reads “Complete” from what I can tell
 sender (TEXT)
 CallerID from the calling party leaving the voicemail message
 (8885551212)
 callback_num (TEXT)
 Callback number left by calling party, usually caller ID
 (8885551212)
 duration (INTEGER)
 Duration in seconds
 (5)
 expiration (INTEGER)
 OSX-epoch based datetime, convertable via date -r
 (1189431482)
 trashed_date (INTEGER)
 definitely based in seconds, haven’t figured out the epoch yet or why it isn’t the same as the other dates based on OSX’s epoch
 flags (INTEGER)
 Voicemail flags
 0 - Not downloaded yet
 1 - Partially downloaded
 2 - New, unlistened or only partially listened to
 3 - Listened completely
 11 - Pending delete, in “Deleted Items”
 15 - Deleted from iPhone, pending delete from voicemail hq
INDEXdate_index
 voicemail (date)
INDEXremote_uid_index
 voicemail (remote_uid)

Other, more complicated DBs, involved in syncing
AddressBook DB

/private/var/root/Library/AddressBook/AddressBook.sqlitedb
AddressBook Images DB
/private/var/root/Library/AddressBook/AddressBookImages.sqlitedb
Maptiles DB
/private/var/root/Library/Caches/MapTiles/MapTiles.sqlitedb
Calendar DB
/private/var/root/Library/Calendar/Calendar.sqlitedb




=========================================================================================

iPhone模拟器文件目录


在编程时,大家肯定要知道应用程序在哪个目录下,iphone也不例外,也有个工作目录,开始时让我也让我找了老半天。下面工作目录的路径:

/Users/stephen/Library/Application Support/iPhone Simulator/User/Applications/






==========================================================================================

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值