How to import photos into the iPhone Simulator

by Robin Summerhill on September 1, 2010

One question that gets asked frequently in iPhone developer forums is, ‘How do I add photos to the Camera Roll in the iPhone Simulator?’ The most-quoted solution is to drag an image onto the simulator window. This will open it in Mobile Safari from where you can save it to the Camera Roll by tapping and holding on the image. This is fine if you just need one or two images, however, if you need to load a large number of photos into the simulator then this one-by-one approach is going to get very tired very quickly. We hit this problem while developing an app for a client that includes a custom photo browser and we needed to load 100s of photos during testing.

The Simulator

Other approaches involve copying image files directly into the Simulator under its Media directory at [home]/Library/Application Support/iPhone Simulator/4.x/Media. However, copying images directly into the Simulator can lead to problems with missing thumbnails or images just not appearing at all in the Photos app or Image Picker.

Our solution was to write an iPhone app designed to run in the Simulator that performs a bulk import of image files from disk. The app leverages iOS support for saving photos to the user’s Camera Roll, which ensures that thumbnails are generated correctly and the Photo database is updated.

The Image Importer app

OK, so it’s not pretty, but it does the job. All you need to do is download the Xcode project at the bottom of this article, build it and run it in the iPhone Simulator.

Once the app is running just follow the instructions. Copy images that you want to import into the folder shown (jpg or png). The default location is a folder called ‘iPhone Images’ under your Pictures folder but you can change this if needed. Click the ‘Import’ button and wait. All being well, your images should now appear correctly in the Photo app. They will also be available through the Image Picker API and the new ALAssetsLibrary API in iOS4.0.

We’d love to hear if you have found this article useful – leave a comment.

Update: Some people are seeing a ‘Data Unavailable’ error. To fix this choose “Reset Content and Settings…” from the iPhone Simulator menu.

If you are still receiving the same error after this then:

  1. Drag and drop an image onto the simulator to open it in Mobile Safari
  2. Click on the image and hold
  3. Choose “Save Image”
  4. Open the Photo app in the simulator to rebuild your photo library

Share and Enjoy:
  • Print
  • email
  • Digg
  • Facebook
  • Google Bookmarks
  • Reddit
  • Twitter

{ 44 comments… read them below or add one }

Magi September 3, 2010 at 9:10 am

Very nice tool!!! thanks…
Just a little problem in the zip: the resource image “aptogo.png” was missing and the project didn’t build properly. I just removed it and all is working fine…


Robin Summerhill September 7, 2010 at 8:24 am

Hi Magi,

Glad you like the tool. I’ve updated the project to include the resource image. Thanks for pointing this out.


Caroline September 11, 2010 at 9:12 am

Thanks very much :) . I was getting the error “Data Unavailable” on the Import, but after I did iPhone Simulator > Reset Contents and Settings, it worked a treat.


Badisi September 23, 2010 at 4:45 am

Thanks for the sample.
Anyhow, it doesn’t work if there is no pictures in the library yet : “Data Unavailable” error
I had to drag and drop an image in the simulator, then click on it and hold, and finally choose “save image”
That creates a new library and after that everything worked well.


danno watts September 29, 2010 at 3:07 pm

thanks so much for writing this handy little utility! it really does help out a TON!



mike October 20, 2010 at 9:00 am

doesn’t work. Data Unavailable error.


Robin Summerhill October 20, 2010 at 9:46 am

See the new update at the end of the article about how to fix this.


Myno December 7, 2010 at 3:11 am

Mahalo Robin, worked like a charm.


Mithun December 7, 2010 at 6:38 am

Hi Robin,
Great tool. Worked nice for me at the first try itself. Thanks


viktor January 10, 2011 at 5:36 pm

Thank you! It works, but path to the folder for import must be without white spaces:
iPhone Images -> iPhoneImages


Robin Summerhill March 4, 2011 at 7:51 am

Strange – it works with folders with space in for me!


David March 2, 2011 at 9:15 pm

I’m using the 4.2 SDK and I get the “Data Unavailable” error every time. I tried both resetting the settings and saving an image and still have the problem. Any other ideas? Thanks!


Robin Summerhill March 2, 2011 at 10:15 pm

You need to open the Photo app in the simulator once you have saved an image from Safari. You should see a progress bar with a message indicating that the photo library is being rebuilt. It should work after this.


David March 3, 2011 at 2:15 pm

That worked, thanks! This app was just what I needed!


David James March 10, 2011 at 8:49 am

Thanks so much for sharing this. I would have been fine with adding single images, but 4.2 isn’t playing nice. Your app works perfect. Thanks again.


Rama Krishna Chunduri March 11, 2011 at 3:32 am

I have a small idea to implement the same with IOS 3.x & may be for earlier too.
However some slight modification must help.
1. Ask user to run this app in simulator once and then exit.
2. Now ask him to navigate to /Library/Application Support/iPhone Simulator/x.x/
3. Now he have too look in all the directories for file.
4. Once he found he can copy all the picture files to documents folder.
5. The next time when opens the app you can just check for no.of.files in Documents directory and start process of importing from documents directory.
6.finally let him exit the app and start photos application.

So,that way you can give 2 downloadables for ios x.x & 4.x
This is just a suggestion, Im sorry if you have already tried this one.


Robin Summerhill March 11, 2011 at 8:26 am


Not sure I follow you. The app works with iOS 3.x already. In fact the UIImageWriteToSavedPhotosAlbum function that is the key to saving photos into the camera roll on the simulator has been around since OS2.0.



balaji bal April 25, 2011 at 7:57 pm

just a big thank you. Spared me a sleepless night.


Dave Bomberg May 29, 2011 at 5:15 pm

Thank you for the utility, works great. You might want to change the label that reads “Add images to this folder” to “Copy images FROM this folder”


Aaron Brown July 10, 2011 at 1:45 am

Thanks so much for this! For some reason saving through safari wasn’t working properly for me. This is an even better solution! BTW, I initially had the error of Data Unavailable and the “Reset Content and Settings” didn’t fix it. I removed the space in the directory path and change it in the path in the app and then it worked like a charm. Life saver :)


Ian Ferguson August 23, 2011 at 11:40 am

Very useful. Safari does not always save images correctly on the simulator. This app does the trick !!!


Dan August 25, 2011 at 6:26 pm

Thanks for the app!

As a follow up to the ‘data unavailable’ error, I spent 20 minutes wondering why it was happening and discovered it was because I had a model view open in Xcode.

As soon as I switched to a class view the problem ceased.


Nathan November 9, 2011 at 9:17 am

Many thanks!


Andy Riordan December 14, 2011 at 2:44 pm

I appreciate this tool, thanks!


Paul January 2, 2012 at 3:36 am

Very useful to import many photos in one go. Thanks a lot.


Glen March 12, 2012 at 11:18 pm

Oh so useful. Thanks heaps for sharing!


Dan April 2, 2012 at 6:13 am

Nice one – great tool!


Nick Kuh May 29, 2012 at 8:00 am

Brilliant solution! Thanks :-)


Bridgette December 23, 2012 at 10:17 pm

I believe what you typed was actually very logical. However, what about this?
suppose you added a little information? I mean, I don’t want to tell you how to run your website, but suppose you added a title that makes people desire more? I mean How to import photos into the iPhone Simulator — Aptogo is kinda vanilla. You might look at Yahoo’s home page and watch
how they write article headlines to grab viewers to open the links.
You might try adding a video or a pic or two to get people interested about what
you’ve got to say. Just my opinion, it would bring your blog a little bit more interesting.


Ingrid December 25, 2012 at 1:31 am

Normally I don’t read article on blogs, but I would like to say that this write-up very pressured me to try and do so! Your writing taste has been amazed me. Thanks, very nice post.


Amit January 31, 2013 at 10:58 am

Thanks for sharing the ImageImporter project. It saved me so much time and pain!


Peter March 12, 2013 at 6:28 am

Thank’s Robin – a timesaver :-)
Was just about to build it when I found your’s, thank’s for sharing.

Suggestion: Maybe add “discovery” of subfolders automatically? Sometimes you want / need a substructure for testin…


arbeitgeberzuschuss pkv April 27, 2013 at 11:31 am

My spouse and I stumbled over here coming from a different page and
thought I may as well check things out. I like what I see so i
am just following you. Look forward to going over your web page for a
second time.


Emmanuel M May 1, 2013 at 6:39 pm

Wonderful script… except for one thing: it strips the EXIF data away.
Does anybody know of an alternative for the 6.1 iPhone simulator? I have more than 1,000 images to transfert to test our app!



Daniel May 13, 2013 at 3:58 am

Hey. Thank you very much! You saved my day Bro! :D


David DelMonte May 16, 2013 at 1:07 pm

Found the link on Stack Overflow. Thank you very much for posting this. Still works great with iOS6.. It’s a great timesaver, and I can learn from the code..


vehicle insurance comparison September 1, 2013 at 1:49 pm

It is Fine to finally understand a website where the blogger knows what they’re speaking about.


Herman Caruana October 27, 2013 at 6:20 pm

Hello just wanted to give you a quick heads up and
let you know a few of the pictures aren’t
loading properly. I’m not sure why but I think its a linking
issue. I’ve tried it in two different web browsers and both show the
same outcome.


Big fish hack January 1, 2014 at 6:07 am

You will soon by subconscious re-programming find information within your reach and even begin exercising without
using any weights and immediately notice an improvement in
your vitality and energy levels. The golden toad and the harlequin frog of Costa Rica are gone completely as a result of the global warming changes we are experiencing.
Uh oh Floe, hang on there — the chunk of ice shrinks.


Zakk Hoyt March 20, 2014 at 2:33 pm

Thanks for the tool. Very useful and a great time saver.


Dananos March 25, 2014 at 6:28 am

I’m getting this error when trying to compile the application – Please email me back if there is a simple solution!

Ld /Users/user6169/Library/Developer/Xcode/DerivedData/ImageImporter-dattxazgubesgefuvyocqkmuzwyt/Build/Products/Debug-iphonesimulator/ normal i386
cd /Users/user6169/Documents/ImageImporter
setenv PATH “/Applications/”
/Applications/ -arch i386 -isysroot /Applications/ -L/Users/user6169/Library/Developer/Xcode/DerivedData/ImageImporter-dattxazgubesgefuvyocqkmuzwyt/Build/Products/Debug-iphonesimulator -F/Users/user6169/Library/Developer/Xcode/DerivedData/ImageImporter-dattxazgubesgefuvyocqkmuzwyt/Build/Products/Debug-iphonesimulator -filelist /Users/user6169/Library/Developer/Xcode/DerivedData/ImageImporter-dattxazgubesgefuvyocqkmuzwyt/Build/Intermediates/ -Xlinker -objc_abi_version -Xlinker 2 -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=3.0 -framework Foundation -framework UIKit -framework CoreGraphics -Xlinker -dependency_info -Xlinker /Users/user6169/Library/Developer/Xcode/DerivedData/ImageImporter-dattxazgubesgefuvyocqkmuzwyt/Build/Intermediates/ -o /Users/user6169/Library/Developer/Xcode/DerivedData/ImageImporter-dattxazgubesgefuvyocqkmuzwyt/Build/Products/Debug-iphonesimulator/

ld: symbol dyld_stub_binding_helper not found, normally in crt1.o/dylib1.o/bundle1.o for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)


JL May 12, 2014 at 5:45 pm


If you’re getting the error:
ld: symbol dyld_stub_binding_helper not found, normally in crt1.o/dylib1.o/bundle1.o for architecture i386 xcode 5

See the solution at:
“For me, I also need to set up the Deployment Target from older version 3.0 to 7.0.”


Mati Bot January 3, 2015 at 9:21 am

Thanks Robin.
I made a github project with a few changes of this code.
Please have a look,


Mati Bot January 3, 2015 at 9:27 am

Leave a Comment

{ 2 trackbacks }

Previous post:

Next post: