I know how to open developer tools from the moment I've launched a web page, it becomes visible in developer menu and I can click to it and inspect it, but there is some code which is being executed on a launch, which I cannot debug. How can I open safari debugger in such way, so I could see everything right from the web page launch?
I'm using the Safari Web Inspector to remote debug a Cordova app I'm building. Previously this has worked like a charm, but now I've run into an issue. After launching the inspector, after a couple of seconds it seems like the web inspector disconnects from the device. The inspector is still open, but the inspector wont update, and elements on the device wont be highlighted anymore when hovered in the inspector (this works for the first couple of seconds). I'm able to get it running for a couple of seconds again by closing the inspector and launching it again.
I've tried debugging using Chrome and ios_webkit_debug_proxy instead, which doesn't disconnect. However, this has other issues which makes it a none viable solution.
I've tried using Safari Technology Preview (11.0 R35) as well as the current stable version of Safari (10.1.2), but the issue occurs in both of them. I've also tried switching the lightning cable and USB-port on my computer, which doesn't make any difference.
I found that the following error is logged (using the Console app) when the inspector seems to disconnect:
RWIServiceLockdownConnection: Disconnecting because we failed to read a message from webinspectord. This could mean almost anything.
This does seem to have something to do with Cordova, since the error doesn't occur when I inspect a regular page Mobile Safari page.
What could cause this, and how do I resolve it?
Try setting a global hotkey:
Go to System Preferences -> Keyboard -> Shortcuts -> App Shortcuts.
Add a hotkey, whatever keys you want (e.g. Cmd + Alt + I) and match that hotkey to your cordova’s main html file (e.g. index.html).
Launch Cordova App.
Open Safari WI & close it.
Re-launch Safari WI with quick hotkey shortcut set above.
Close & re-open cordova app, Safari WI should keep debugging.
Also, as stated in comments, try keeping Xcode open.
I've been struggling to debug my standalone webapp with safari's web inspector. The web inspector works fine when I go to the url on the iphone's safari like a normal web page. The problem appears when I add the webapp to the homescreen. I'm having a strange bug that causes my app to crash when I start it from the homescreen and I want to see what's happening, but when I try to open the web inspector on the mac it opens for a second and then it closes unexpectedly with no message at all (also the webapp on the iphone closes). Thanks in advance. More info about the devices and versions:
- iPhone 5SE with ios 10.3.2 (14F89)
- Macbook Air with MacOS Sierra 10.12.5
Well it seems that Safari is having a bug regarding the cache when I add the webapp to the homescreen using the same app name I was previously using. I tried deleting the old one on the homescreen and add it again but with a different app name (short name) and it worked (it loaded the latest version of the webapp) and the bug I was trying to get rid of in the first place was finally gone. I'm concerned however about asking the user to add the app again to the homescreen with a different app name to get the latest version. Maybe that's a sign that I should move on to service workers :)
Background
My company recently made a shift to app development. While developing and Q/Aing on Android was relatively painless, iOS, on the other hand is proving to be a pain.
The task involves looking at the page source of our app (which has a custom browser). I heard that Web Inspector is a great tool, so I went with it.
Problem
First of all, Web Inspector has been able to detect the custom browser before.
But quite frequently, Web Inspector's menu gives the "No Inspectable Applications" prompt.
This happens with the exact same version of the app that worked earlier.
There seems to be no trigger whatsoever; yesterday Web Inspector was working with the custom browser, and then after a few hours (during which I may have disconnected and reconnected the iPhone) it stopped working.
I have not been able to figure out why despite breaking my head for a week.
Observations
I have an iPhone 4S running iOS 7.0.4. My Mac Mini has Safari 7.0.
In the phone options
Web Inspector is turned on in the iPhone menu
All privacy modes are set to off - Do Not Track, Block Cookies, etc. (this question)
Javascript is turned on in the phone.
In Safari on my Mac Mini
- Develop menu is enabled (obviously)
More observations
iOS Safari is detected by Web Inspector.
So, how do I go about debugging this? What could be a possible cause and what could be the solution?
I was having the same problem, it was cause I was running iOS 8,fixed by updating Safari to 7.1 .
An update for iOS 9 (using OSX El Capitan):
On your mobile device under Settings -> Safari -> Fraudulent Website Warning = OFF [default = ON]
For me to make it work I needed to go into iPhone's Settings -> Safari > Advanced and enable Web Inspector option. (iOS 9.1)
I was having exactly same trouble. I managed to correct the situation by clearing the cookies and history from the mobile Safari menu. After this, it showed up in the Mac Develop menu.
Hopefully this will correct your situation as well.
this is probably an oversight where someone forgot to include the ios 8 version of Mobile Safari as an inspectable application. Get with it guys. I was able to connect my iPad to a MacMini we have with Yosemite Beta.
So I have also discovered that the web inspector in Yosemite Beta doesn't inspect well. I am able to Breakpoint in Javascript, but items are not inspectable in the inspection pane. The console does report correct information. Don't be fooled as I was! To inspect the value of something in this web inspector you must access the values via the console, type in the variable and it will return the result it has correctly.
As it happens, the solution that worked for me (reliably) was:
Build the app from source locally (in Xcode)
Deploy it to the iPhone, connected through USB
For some reason, Web Inspector works reliably when the app is started this way. I am unable to figure out why, but it works. Comments welcome.
Here's a possibility, mostly because I just ran into this myself...
Is your browser set for private browsing?
If it is, turn that off! You can't use the inspector while it's on.
The BlackBerry Device Simulator v6.0.0.706 (9800) freezes every time I attempt to load a page in the browser. I'm able to load the browser and go to www.google.com, but loading any other page freezes the entire simulator. To get back into the simulator, I have to close the window and relaunch.. stopping page load or pressing any of the other buttons in the window does not work.
This is what I have tried:
Tried loading other web pages to see if the problem persists.
Tried installing to C:\BlackBerry instead of the default directory in case spaces were an issue.
Updated to allow full access to all users and my Windows user account.
Tried running as Administrator.
No error messages display, the simulator just freezes and stays stuck on the same page until I relaunch the simulator. I am running this on Windows 7. Thanks for your help.