Meltemi
Meltemi

Reputation: 38359

My iPhone Simulator 3.0 AddressBook is empty!

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.

Upvotes: 2

Views: 3510

Answers (6)

tony897
tony897

Reputation: 1

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.

Upvotes: 0

0xced
0xced

Reputation: 26558

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

Upvotes: 1

djibouti33
djibouti33

Reputation: 12132

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

Upvotes: 0

Matthew Frederick
Matthew Frederick

Reputation: 22305

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]/

Upvotes: 2

Jeff Schilling
Jeff Schilling

Reputation: 501

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.

Upvotes: 4

Daniel A. White
Daniel A. White

Reputation: 191037

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

Upvotes: 1

Related Questions