Tuesday, July 22, 2008

Lost & Recovered iPhone notes

Somewhere along the way I lost the Notes on my iPhone when I moved from my old iPhone to my new one. After some research I found iTunes saves your iPhone backups at:

/Users/<user>/Library/Application\ Support/MobileSync/Backup 

In that location I had 3 backups, I found one before I got the new iPhone 3G and made a copy of the directory to work on.

Then I found a tool on the net that converts these binary plist files into the normal file format. The tool crashed on me and the fix was just commenting out the "sys.exit(2)" around line 33. After that was complete I had a series of normal .plist files and some .sqlite files. 

Running the tool created a new directory, "MobileSyncExport"

Under there you will see Library/Notes/notes.db

Using a sqllite browser you can browse that database file. Go to the "note_bodies" table and there are all your full notes from the iPhone backed up.

I then copied these into Notes in Apple mail which sync to MobileMe and appear in the MobileMe Notes IMAP folder. Not exactly the same place they were on the other iPhone but at least they're restored and back in my pocket.

Apple, when will you be sync'ing iPhone notes? Allowing me to create a note from an email body? Doing anything useful with them?

As a side note, if you want to make an app that saves call history, sms history or other things you could easily watch/extract all that from these databases. Combine that with TimeMachine and you have a not-so-secret paper trail of SMS messages, call logs etc... 

6 comments:

Tom said...

Hi there. Unfortunately, I have lost a large chunk of notes and am seeking knowledge as to how to restore them. I am not pro, but was able to determine that my notes must be present using a SQLite add-in for firefox. I found files titled "...notes," calculated the days since 1970, and determined that there was a wide range of notes created in the missing period.

Would you please enlighten me with what you mean by "run" the script? In Terminal? Thanks for your help. Cheers.

Rob said...

Seems that since I blogged this a GUI version of the tool became available, try it: http://supercrazyawesome.com/

Tom said...

Thanks, Rob. For some reason, I cannot find any "notes" in the list of available backed up items. The only thing that seems to come close is something along the lines of "OS files." I cannot actually tell you the name of it right now b/c the GUI is frozen (second time trying to run it). If I want to try the way you outlined, how do i run the script? I have copied the file into an external location so the original will not be affected.

Rob said...

This is the URL to the command line version:

http://iphone-backup-decoder.googlecode.com/files/decode_iphone_backup_v2.1.py

looks like you'd run it like this from the OSX terminal:

python decode_iphone_backup_v2.1.py test.mdbackup

Tom said...

Cheers. Looks like the "iPhone OS files" file is the one i wanted. However, could not find notes! No idea how they could have disappeared in a matter of an hour. And it's curious--only a certain period is missing, not all notes.

Rob said...

You have time machine backups?