How do I open developer tools on iOS Simulator? - ios

I am wanting to open developer tools on an iOS simulator
I have taken the following steps, on a 2016 MacBook running macOS Sierra 10.12.1 and don't know how to get any further:
I have Xcode installed
I create a new playground
Right click on the Xcode dock icon and click Open Developer Tool > Simulator
I now have an iOS simulator running whichever device I need, in my case iPhone 6 running IOS 10.0
Now I am wondering what steps do I take to debug, and inspect elements on a webpage as I would in Safari or Chrome developer tools?

Open Safari and go to Preferences. Under the Advanced tab, at the bottom, you'll see "Show Develop menu in menu bar". Make sure that is checked like in the image below.
Once that is checked, you'll see a new menu bar item named "Develop" between "Bookmarks" and "Window" in Safari's menu. Under the Develop menu, select "Simulator" and then select the site you want to debug. A new window with the developer tools will then pop up:

Download https://developer.apple.com/safari/technology-preview/
Open the website you want on your simulator.
On "Safari Technology Preview", under
Develop > Simulator --- [SimulatorName] > select your website from the list.

If you are on a mac, press CMD + G while running the Simulator on XCode. This will allow you to Inspect element like you can on a web browser.
To hide the menu, press CMD + D.
It looks like the most accepted answer incorrectly assumes the asker is wondering about Safari Simulator, not XCode Simulator.

If you're using React Native then you can install react-devtools globally and access devtools that way. To do this:
Install it by running npm install -g react-devtools from your terminal
Run react-devtools from your terminal
Make sure your app is running in the simulator
Open the in-app developer menu in the simulator by pressing cmd + D
You should now see the components list from the React Devtools Electron app.

Related

XCode - Runner - cannot select device emulator

I want to start by saying that I'm new to macOS and I'm sorry if this question is wrong formulated.
So, I have a mobile app wrote in Flutter. I open the Runner file from the terminal with: open ios/Runner.xcworkspace and XCode shows up. My problem is that where I should select the device where I want my application to be built, the only option is : Any iOS Device.
So, I thought that I do not have any simulators installed on this machine, but I do. This is what I have installed (Window->Devices and Simulators):
When I try to run my code with "Any iOS Device" selected this problem occurs:
I don't know what to do in order to run my app on one of these devices.
You just need to click on that Any iOS Device area:
And then just choose the device/simulator you want to test on:
In my case, in order to fix this, I had to go to my project setting -> build settings and change Supported Platforms values to iOS (it was macOS selected).

Unable to run app in Simulator : Xcode 6.0.1 iOS 8

I updated my Xcode to 6.0.1 from the App Store update notification
in the morning in the os X 10.9.5, and then restarted my mac.
Then i found the Xcode has been updated to the 6.0.1 ,But when i tried
to run my app on it i am getting only iOS device as the device,not
simulators.
in my simulator menu manage devices there is no simulators only my
mac is present ,then i tried to add simulators but it has given me
error of path is not found,i tried every solutions found in the web
search like locations tab command line tools,everything is fine,
But still i am not getting the simulators?Can anybody help me on this?
Might be that resolve by tap Xcode6--> Window--> Device like following image:
When you select Device Option you get following window open:
There is appear all simulator or connected devices. If you found No simulator you can add by click on + Button then you get following window create simulator.
click an option there is simulator list and you get simulator. Hope that solve you issue.
Choose Preview > iOS Simulator Version > iOS 6.0 or 6.1.*
Choose Preview > Preview in iOS Simulator.
If you don't see iOS 6.0 or iOS 6.1, see Downloading and Installing Xcode Components in the iOS Developer Library.
What is the output of 'xcrun simctl list'?
Is there anything interesting in ~/Library/Logs/CoreSimulator/CoreSimulator.log to indicate a problem?
Are you able to add and delete simulator devices from the device manager?
Can you add and delete devices from the command line 'xcrun simctl create ...'?
The one thing I can suggest is checking xcode-select from a Terminal. Type xcode-select -p and look at the output. This should be the Contents/Developer directory within your Xcode application. On my machine - because I don't leave Xcode in the Application folder, it reads /Applications/Developer/Xcode.app/Contents/Developer/. Make sure it's actually pointing at where Xcode is installed. For example you may be putting Xcode in a directory other than the usual /Applications, while xcode-select is looking for the Xcode internals in a different place than where Xcode is. I've been caught out by this before now.
Follow these steps to add a (new) simulator
Click on Simulator icon and open simulator list.
At the end of list, there is an option to add new simulator "Add Additional Simulator". That will open 'Device & Simulator' window.
Switch to 'Simulator' tab.
There are three field in simulator tab.
Click on '+' icon, on left bottom corner of window.
Simulator Name: Enter simulator name here
Device Type: Select iPad from this dropdown list
OS Version: Select OS version from this dropdown list
Click on 'Create'
A new simulator will be added in your Simulator option list.
Look at this snapshot to understand flow of above steps:
And if there is no simulator/OS version in simulator list, you're looking for,
Click on Simulator icon and open simulator list.
At the end of list, there is an option to add new simulator "Download Simulator". That will open 'Component' window (from Xcode >> Preferences).
Select/click simulator from list, which you need to download.
Look at this snapshot:

Why Safari shows "No Inspectable Applications" during remote debugging with iOS 6 device?

When I connect my iOS 6 device for remote debugging for testing my mobile web application, The safari develop menu with my device name shows "No Inspectable Applications".
I have enabled web inspector ON in my device safari device settings.
Why this is happening?
An update for iOS 9 (using OSX El Capitan):
On your mobile device under Settings -> Safari -> Fraudulent Website
Warning = OFF [default = ON]
I also needed to re-connect the iPhone after changing this setting
This solved it for me.
If you have private browsing enabled in Settings > Safari, you will not be able to use remote debugging. If you turned off private browsing, it will work like a charm.
I recently had problems debugging a UIWebView in desktop Safari – and it turns out the problem was with my Xcode configuration for the app. The most recent build had been provisioned for production, rather than for Testing. After re-building the app for Testing, it showed up once more in the Safari Debug menu :-)
I had the same issue eventually I understand that the problem is with the Xcode settings.
To solve this issue:
Enable Safari Debug
First of all verify that on the device you have enabled the Safari debugger (on the device go to: Settings >> Safari >> Advanced >> Enable Debug; or iOS 9+ turn on: Settings >> Safari >> Advanced >> Web Inspector). If you've done this you will see your device in Safari >> Develop. if you see your device but you don't see your application under it, instead "no inspectable application", check your Xcode settings.
Xcode
1. Change Build Configuration:
Right click on the project name (under the play/run button) and select 'Edit Schema...', in the 'Edit Schema' window under 'Run' tab change the 'Build Configuration' to 'Debug' (instead of 'Release')
2. Change the Code Signing:
Click on the project name in the files tree, to display the project settings.
Select the 'Build Settings' tab. Change the 'Provision Profile' to 'Automatic'. Change the 'Code Sign Identity' to 'iOS Developer'.
Note that changing the code signing will prevent you from release versions for production, however you will be able to debug your application.
A few things to try:
On your iPhone/iPad, double-tap the Home button to bring up the list of running apps, close Safari (or appropriate Web App), then reopen
Quit/reopen Safari on the Mac
Unplug/plug back in iOS device
As a side note, I can attach to Safari with private browsing enabled on the iOS device.
I went to Settings > Safari > Advanced and toggled the Web Inspector switch from on to off to on again. That did it for me!
If you just installed XCode 9, do not forget to install Safari 11, or you will see "no inspecable applications"
I had the same problem with Safari 11.0.3 on High Sierra. The only think that worked for me is installing Safari Technology Preview from here.
Make sure you aren't connected to a VPN.
In my case, I had Safari 10.0.2, running on El Capitan and when trying to run apps on the Simulator (iphone 7), I did not even have the Simulator option in the Safari's Develop menu. Updating to Sierra, solved the problem.
I resolved the issue with rebuilding the app with new key - certificate (p12) and provisioning profile. My developer account and certificates expired, so it just stopped recognizing my PhoneGap app in Developer menu.
After all the answers here failed to resolve the issue for me, I figured out that installing the Safari Technology Preview version worked well.
Install this beta of Safari, launch it, enable developer tools in advanced preferences, and your phone will appear in the develop bar (provided a page in mobile Safari is open).
I was trying to get this working via the iOS simulator and none of the previously stated answers worked, even though I tried them all.
Instead, running the following worked:
npm install -g ios-sim
After that, once I started the application, the simulator appeared under the Develop menu on Safari.

How can I use Instruments Automation in the iOS Simulator? It cannot attach or find iOS Simulator

How can I attach to an application currently running in iOS Simulator 6, or start an application using Automation in Xcode Instruments?
I'm using Xcode 4.5. I see my app is running in the Simulator.
If I launch Instruments, I select the "iOS Simulator -> Automation" template.
However, the drop down on top tells me under "Attach to process" that "Current Instrumentation disallows attach" and when using "Choose target", I'm presented a list of Apps from my Applications folder, but none of them is iOS Simulator, since it is inside the Xcode.app bundle.
It is working just fine on the device.
Any ideas?
"Attach to process" gives me the same result: "Current Instrumentation disallows attach." So I can't answer that part of your question.
To run your app in simulator from Instruments:
Be sure your mac is selected in the "Choose target" drop-down
In the Choose target drop-down, select Choose target -> Choose target
You will see that list of apps in your application folder -- you got this far
Now click the down-pointing triangle next to Applications to close Applications folder or simply scroll down farther to reveal the rest of the top-level folders on your mac
Browse to your app
Find it in a path like this: /Users/YOUR-USER-NAME/Library/Application Support/iPhone Simulator/5/Applications/GUID/YOUR-APP-NAME
Oddly, the file browser does not display folder "extensions," so iOS version 5.0 and 5.1 both show up as "5" in the folder list

How to upgrade iPad simulator to iPad(Retina) simulator?

I am using XCode 3.2.5, and I want to run my apps on iPad(Retina) simulator, how can I do this.
You need to install 4.3.1. It's in the Mac App Store. From the simulator, use the hardware menu and select what you want.
UPDATE: 4.3.1 with iOS SDK 5.1 it appears
I guess this functionality would only available in xcode 4.3.1 ..
There is a way to install the iOS 5.1 SDK to xcode 4.2, which works with Snow Leopard, and you can also include iOS 5.1 for the simulator.
Here are the steps on how to do it:
http://www.iphonedevsdk.com/forum/iphone-sdk-development/100229-snow-leopard-sdk-5-1-a.html
It is working on my application currently in development but I haven't subitted it to the app store yet.
Follow these steps to add a (new) simulator
Click on Simulator icon and open simulator list.
At the end of list, there is an option to add new simulator "Add Additional Simulator". That will open 'Device & Simulator' window.
Switch to 'Simulator' tab.
There are three field in simulator tab.
Click on '+' icon, on left bottom corner of window.
Simulator Name: Enter simulator name here
Device Type: Select iPad from this dropdown list
OS Version: Select OS version from this dropdown list
Click on 'Create'
A new simulator will be added in your Simulator option list.
Look at this snapshot to understand flow of above steps:
And if there is no simulator/OS version in simulator list, you're looking for,
Click on Simulator icon and open simulator list.
At the end of list, there is an option to add new simulator "Download Simulator". That will open 'Component' window (from Xcode >> Preferences).
Select/click simulator from list, which you need to download.
Look at this snapshot:

Resources