DevKB
Web Development Knowledge Base
HOME | TOP 20 | WRITE AN ARTICLE |
Sections :



RSS RSS Feed

You too, please publish your useful code snippets in any programming language :
write an article !


Valid HTML 4.0 Transitional

Plateforme d'envoi de gros fichiers en ligne
Dépannage site web
Blog infogérance
Hébergement e-mail

Olivier Ligny - - 19/08/2012 - vue 26834 fois

Manual contact backup and restore on iPhone

This will help you to manually backup and restore the iPhone contacts database.
You may need a jailbroken iPhone to do that.
I just tested on iPhone 3GS with iOS 5.1.1 and it worked fine.
But there may be other easier solutions ...
 

1) BACKUP
 

  1. Copy AddressBook.sqlitedb from /private/var/mobile/Library/AddressBook/ on your iPhone, to your computer.
    You can access the file by SSH, or by using a software like iFunbox, iExplorer, WinSCP, etc.
    Tutorial : http://www.simonblog.com/2009/05/17/how-to-use-ssh-to-transfer-file-on-iphone/
     
     

2) CONVERT AND RESTORE
 

  1. The AddressBook.sqlitedb file is the raw contact database of iOS, you have to convert it to CSV first.
    If you just copy it back to iPhone, it won't work most of the time, and you contact app may become buggy.

    You must have installed the sqlite3 program on Linux or Windows.
    Open a shell prompt and type the following command (on one line) :
    sqlite3 -csv -header AddressBook.sqlitedb "select ROWID, first, last, 
    identifier, value, record_id from ABPerson p join ABMultiValue mv on 
    (ROWID=record_id) " > mybook.csv
    The new CSV file will have one line per information, one line for each phone number or email address :
    ...
    1431,John,SMITH,0,contact@smith.net,1431
    1431,John,SMITH,0,0121596135,1431
    1431,John,SMITH,1,0655124798,1431
    1432,Home,,0,0141901075,1432
    1432,Home,,1,0660018292,1432
    1433,David,KINGSTON,0,kingston.d@gmail.com,1433
    ...

     
  2. Download and install free csv2vcard application :
    http://sourceforge.net/projects/csv2vcard/
    Use it to create a VCF file from the CSV file, by matching each column to a valid VCard field.
     
  3. Send yourself the VCF file as an email attachment. Open this attachment in iPhone's Mail app. You will be able to import the contacts in one tap.
     
  4. Download and use an app like Cleanup Duplicate Contacts by Wim de Nood, or SmartMerge by YT Developments, to merge multiple contacts informations back into single contacts (all phone numbers into the same contact).

Anon - 26/04/2017
Great tip, thanks!
Export works on ios 8, didn't try the import, but the csv file is fine


Write a comment :
Your name :     E-mail (optional) :

AntiSpam : what animal is visible on this picture ? :

Nos partenaires : iPhone 8 Cases & Protection