Question

Anyone know how to repopulate my Simlator's AddressBook with Johnny Appleseed, etc? Or, my own data. Doesn't matter.. It's just that it's somehow empty now and useless for testing.

Was it helpful?

Solution

Have you tried resetting the firmware? Theres an option in the menu somewhere.

OTHER TIPS

Mine goes missing every so often. No rhyme or reason around it.

I back up a copy of /Users/[your user name/Library/Application Support/iPhone Simulator/User/Library/AddressBook/AddressBook.* to a safe place and copy it back when it goes missing.

This is also a good strategy to have multiple address books for testing.

Choosing "Reset Content and Settings" from the iPhone Simulator menu sounds good, but it's exactly how you accidentally delete your default contacts.

After doing so the User directory will be in your trash. As Jeff Schilling above mentioned, you can just put it back in your /Users/[your user name]/Library/Application Support/iPhone Simulator/ directory and you'll get your addresses back.

If your goal was to clear out a preferences file you wrote or something similar you'll find it in that User directory, burrowing further down into Applications/[unique ID of your app]/[somewhere in here depending on what your app wrote]/

See my Using your own address book in the iPhone Simulator blog post.

As I state there, just run the script to get your own address book in the simulator:

#!/bin/bash

cd ~/Library/Application\ Support/MobileSync/Backup
backup=`ls -t1 | sed -n '1p'` # most recent backup
for f in "$backup"/*.mdinfo; do
    grep -q "Library/AddressBook/AddressBook.sqlitedb" $f
    if [ $? -eq 0 ]; then
        addressbook=`basename $f .mdinfo`
        cp -v "`pwd`/$backup/$addressbook.mddata" ~/Library/Application\ Support/iPhone\ Simulator/User/Library/AddressBook/AddressBook.sqlitedb
        exit $?
    fi
done

echo "Address Book not found in iPhone backup" >&2
exit 1

This worked for me. It extracts your address book data from an unencrypted iPhone backup. Works on non-jailbroken phones.

  • 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

I realise this is quite an old thread but I found myself in a similar situation where I needed to repopulate my Simulator's address book with the sample contacts (Johnny Appleseed, etc.)

Here's the quickest way to do this:

  1. With the iOS Simulator running, right click on the icon an click Options > Show in Finder
  2. Right-click on the iOS Simulator icon and select Show Package Contents
  3. In the new finder window, browse to the folder Resources > Sample.SimulatorContent > Library

In there you'll find an AddressBook folder. Use this to replace your user's AddressBook folder ~/Library/Application Support/iPhone Simulator/{SDK}/Library/

Once you restart the iOS Simulator, go to your Address Book and you'll once again find the sample contacts, Johnny Appleseed and friends.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top