Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import contacts from Mac OS X AddressBook into iPhone Simulator

Is there a way to import contacts automatically from my Mac OS X Address Book into the iPhone Simulator Contacts app? Or vCards or anything like that? I'm building an app that displays contacts in various ways and I'd like to have a way to have lots of contacts without typing them all in myself.

like image 218
Simon Woodside Avatar asked Feb 14 '10 03:02

Simon Woodside


People also ask

How do I create a VCF file from multiple contacts on a Mac?

Step 1: Select the contacts you with to export. From the Contacts app on your mac, hold down the SHIFT key to select groups of multiple contacts that are continuous or hold down the COMMAND key to select multiple contacts that are not continuous. Step 2: Right-click and choose “Export vCard.”


6 Answers

This solution worked for me, and was incredibly easy.

The question asks about how to get Mac OSX contacts into the iOS Simulator. If you sync your iPhone with your Mac, then perform an unencrypted backup of your iPhone in iTunes, this solution will work:

  • Quit the iOS Simulator
  • Download iPhone/iPod Touch Backup Extractor
  • Run it, and select the last option "iOS Files"
  • Create a folder on your desktop and extract all files to that folder
  • When complete, go to your extract folder and navigate to Library/AddressBook
  • Copy both files (AddressBook.sqlitedb and AddressBookImages.sqlitedb) to: ~/Library/Application Support/iPhone Simulator/{SDK}/Library/AddressBook
  • Run the Contacts application in iOS Simulator
like image 128
djibouti33 Avatar answered Sep 24 '22 19:09

djibouti33


I have Xcode 6, and when I drop a vCard file into the simulator window, it gives me the option to import.

So go to your Mac OS X address book, select all contacts and export them to a vCard. Then drag and drop that file into the simulator.

What happens when you drag and drop a VCF file

like image 22
Marc Avatar answered Sep 23 '22 19:09

Marc


Probably not directly, but it you have a real phone populated with contacts you could retrieve the file /mobile/Library/AddressBook/AddressBook.sqlitedb and copy it to ~/Library/Application Support/iPhone Simulator/User/Library/AddressBook/AddressBook.sqlitedb on your dev machine.

like image 37
nobody Avatar answered Sep 24 '22 19:09

nobody


You can do this very simple:

  1. Just download this app: https://github.com/aussiegeek/AddressBookVcardImport

  2. Create a vCard with all the contacts you want to import and name it "vCards.vcf"

  3. Add this file to the XCode Project and run it on the simulator.

like image 28
Thomas Kiesl Avatar answered Sep 21 '22 19:09

Thomas Kiesl


If you've a jailbroken phone, copy /var/mobile/Library/AddressBook/* from your iPhone to ~/Library/Application Support/iPhone Simulator/[version]/Library/AddressBook on your Mac. Unfortunately, the pictures don't work for me even though I copied AddressBookImages.sqlitedb as well.

like image 35
Ortwin Gentz Avatar answered Sep 22 '22 19:09

Ortwin Gentz


djibouti33's answer worked for me as well, but there is one key exception in his steps for the iPhone Simulator folder location. Below worked for me.

  1. Quit the iOS Simulator
  2. Download iPhone/iPod Touch Backup Extractor
  3. Run it, and select the last option "iOS Files"
  4. Create a folder on your desktop and extract all files to that folder
  5. When complete, go to your extract folder and navigate to Library/AddressBook
  6. Copy both files (AddressBook.sqlitedb and AddressBookImages.sqlitedb) to your clipboard
  7. Within Finder, select GO on the menu bar and Go To Folder "/user//library/" this is the only way to get to the hidden library folder (at leaset for Mac OS X 10.8)
  8. Go to Application Support/iPhone Simulator. there will be separate folders for each iOS version (5.0, 5.1, 6.0 etc).
  9. For each iOS version you run in simulator, you will have to copy the two files to each of the iOS Version folders. Ex: Application Support/iPhone Simulator/5.0/AddressBook/ if you run simulator for iOS 5.0.
  10. If run against multiple iOS versons, repeat for each.
  11. Run the Contacts application in iOS Simulator

Hope this helps!

like image 32
RodneyJ725 Avatar answered Sep 24 '22 19:09

RodneyJ725