Reputation: 38359
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
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:
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
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
Reputation: 12132
This worked for me. It extracts your address book data from an unencrypted iPhone backup. Works on non-jailbroken phones.
Upvotes: 0
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
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
Reputation: 191037
Have you tried resetting the firmware? Theres an option in the menu somewhere.
Upvotes: 1