Adding an image to the iPhone Simulator via the command line

So from the notes I was given, this is the command to make it work

xcrun simctl addphoto 6A0CB955-C22B-48A6-A7F5-809806EB57F2 /Users/username/Dropbox\ \(Evernote\)/Scannable\ Image\ Library/Moleskine.jpg

Which failed for me.

An error was encountered processing the command (code=146):
Invalid device state

Then I found out that you need the iPhone Simulator running first to make this work, considering I got the notes and overview in a knowledge before someone left the company, I can understand how details like that were lost.

So you need the iPhone simulator running and the command will add an image to the iPhone Simulator (though this caused other failures for)

So Command Usage

  • xcrun (Run or locate development tools and properties Command line)
  • simctl (Command line utility to control the iOS Simulator)

So me in this case I need to add a photo for processing by our app, fortunately there is a command “addphoto”

  • xcrun simctl addphoto (Device ID) /PATH To Image
    • Note 1: Simulator needs to be running for this command to work
    • Note 2: You can drag an image to the command line and OSx will put in the path to the image for you
  • Example: xcrun simctl addphoto 6A0CB955-C22B-48A6-A7F5-809806EB57F2 /Users/username/Dropbox\ \(Evernote\)/Scannable\ Image\ Library/Moleskine.jpg
    • username = your actual username

 

 

Advertisements

About thewere42

Software tester by day - parent by night - with too many interest and too little time - spanning cooking, going green, photography, technology, transportation, and the world in general

Posted on April 22, 2015, in iPhone Simulator, xcrun. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: