Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 6 - How to Open Url in IOS Simulator Mobile Safari from Terminal?

I recently updated to Xcode 6 and now the command I was using before doesn't work:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/Contents/MacOS/iPhone\ Simulator -SimulateApplication /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk/Applications/MobileSafari.app/MobileSafari -u "http://google.com/"

I do a lot of front end work and responsive design and must look at the results in every browser multiple times a day. It is very painful without this command.

Also, I would like to open in IOS7 with one command and IOS8 with another.

like image 208
Stoutie Avatar asked Sep 26 '14 18:09

Stoutie


People also ask

How do I inspect Xcode simulator in Safari?

Inspect the page. In the Safari on your Mac, on the Safari menu bar, choose the "Develop" menu. Scroll to the iOS Simulator option. Select the page for debugging.

How can I launch the iOS simulator from terminal?

Just type this command in Terminal: open -a Simulator. app to launch the most recent simulator. Type this command in Terminal to run the Simulator rigth from the its folder.

How can you access iOS simulator in Xcode?

Open Xcode. Select the Window menu option. Choose the Devices and Simulators menu. Select the Simulators tab.

Does deeplink work in iOS simulator?

DeepLinkr comes with both a Mac and iOS app so you easily verify behavior against the iOS Simulator or your own device.


1 Answers

xcrun simctl openurl <Device UDID> http://www.google.com

You can determine the Device UDID by running xcrun simctl list or on newer versions, you can use "booted" instead of the UDID to refer to the currently booted device:

xcrun simctl openurl booted http://www.google.com

Note that this requires the iOS Simulator to actually be running. Depending on the version of Xcode.app that you have, you may be able to use the "booted" alias instead of the device UDID to select the currently booted device.

You may also want to look at Xcode 6 - Launch simulator from command line for information about how to launch the iOS Simulator app and have it start a specific device.

like image 135
Jeremy Huddleston Sequoia Avatar answered Oct 04 '22 02:10

Jeremy Huddleston Sequoia