Is it possible to wirelessly debug an iphone webapp? - ios

I currently have to have my iPhone physically connected by USB to run remote debugging in Safari. Is it possible to do it via bluetooth or some other wireless method?

You have to plug the phone to your computer, is not possible to do it remotely so far.

It is now possible to do wireless remote debugging using "Safari Technology Preview":
Remote debugging with mobile Safari also works without a cable connection to the desktop computer. But you have to install Safari Technology Preview on your Mac as the stable Safari version currently does not support wireless remote debugging. Just do the same setup as described above, but connect the cable and open Safari on your iOS device. In Safari Technology Preview, make sure you enabled “Show Develop menu in menu bar” and enable Develop → "Your mobile Device Name" → Connect via Network in the menu. Now you can unplug the cable and check whether Develop → "Your mobile Device Name" still shows up on the desktop Safari.

It is possible now - I put it here to tie the threads - see here
https://apple.stackexchange.com/a/333876/100894

Currently, it is not possible to debug directly on iPhone from a Mac wirelessly. You will need to connect the iPhone via USB cable to a mac and then use the Safari Preview Technology browser.

Related

Can we remotly control iPhone connected to remote machine to trust developer (for provisioning profile)?

I'm working on remote mac machine using Team Viewer.
At times I need to build WebDriverAgent project on that machine and manually trust the WebDriverAgentRunner and Initegration app on the connected iPhone.
But remotely I cannot interact with the iPhone and need someone physically present there to tap on "Trust" from iPhone settings.
Is there any way I can control iPhone?
Yes, there are several apps that offer this.
One app I recommend (no affiliation) is ApowerMirror. Download link. It allows you to remotely control the iPhone so you can "trust" the developer.
Note: You will need to be on the same WiFi as the iPhone.
Alternatively, if you can't be on the same WiFi, you can connect the iPhone to the Remote Controlled computer and control the iPhone from the Remote Controlled Computer, so it goes:
iPhone -> RC computer -> Your computer

How do I make web inspector work iOS 13.3.1 and Safari 13.0.5 or Safari Technology Preview 13.2?

I am connecting my iPhone 5 SE with an Apple OEM lighting-to-thunderbolt cable. I have the latest version of macOS (10.15.3) installed.
I have made sure that the Web Inspector setting in Settings > Safari > Advanced is turned on.
On both Safari and Safari Technology Preview I have enabled the Develop menu. My device does not show up in either.
I tried removing trusted devices from my iPhone by resetting my location and privacy in General > Reset. I then re-added my macOS system as a trusted device. This did not help either.
Any thoughts?
I am using OSX 10.15.3, (non-preview) Safari 13.0.5 and an iPhone 7 (A1660) running iOS 13.3. I plugged the phone into the Mac for the first time and trusted the computer. The Web Inspector and Remote Automation settings are available on the phone. Desktop Safari is able to find the phone in its Develop tab. It is possible to debug web pages or progressive web apps saved to the home screen, when one or both of Web Inspect and Remote Automation are enabled on the phone. Even if the debugger is not enabled, desktop Safari still knows the phone is there but shows No Inspectable Applications.
Try setting up WiFi sync for the phone, and connecting it with the cable.
I am using this tool- Safari Technology Preview to debug my iphone on mac.
Download link- https://developer.apple.com/safari/technology-preview/

how to wireless debug in ipad mini 2? [duplicate]

Wireless debugging was recently added as a feature in Xcode 9, iOS 11, and tvOS 11. Apple TV 4K doesn't have a USB port, so it requires wireless debugging. How do you perform this wireless debugging in Xcode?
Set up a device for network debugging
from help.apple.com
Debug your app running on an iOS or tvOS device over a Wi-Fi or other network connection.
Steps to set up iPhone, iPad, or iPod touch
Check that your device has a passcode and add one if it doesn't. Your device must have a passcode to enable remote debugging
The Mac and the iPhone/iPad need to be on the same network to use wireless debugging.
Next, in Xcode
Choose Window > Devices and Simulators, then in the window that appears, click Devices.
Connect your device to your Mac with a Lightning cable.
In the left column, select the device, and in the detail area, select Connect via network.
Xcode pairs with your device. If Xcode can connect with the device using a network, a network icon appears next to the device in the left column.
Disconnect your device.
Now you are ready for debugging over the network.
Sometimes it doesn't work. You might need to restart the device or network connection.
Note: Network debugging requires Xcode 9.0 or later running on macOS 10.12.4 or later, and on the device, requires iOS 11.0 or later, or tvOS 11.0 or later.
Steps to set up Apple TV:
Make sure your Mac and your Apple TV are on the same network.
Choose Window > Devices and Simulators, then in the window that appears, click Devices.
On your Apple TV, open the Settings app and choose Remotes and Devices > Remote App and Devices.
The Apple TV searches for possible devices including the Mac. (If you have any firewall or Internet security, disable/turn it off to allow searching.)
On your Mac, select the Apple TV in the Devices pane. The pane for the Apple TV is displayed and shows the current status of the connection request.
Enter the verification code displayed on your AppleTV into the Device window pane for the device and click Connect.
Xcode sets up the Apple TV for wireless debugging and pairs with the device.
I have tried using Xcode Devices window's Connect via network options. but I am unable to see the "Connected over the network" icon next to the device name. also as soon as remove the USB the "Connect via network" option disappeared. also, the device name appears under the disconnected device list.
But using the "Connect via IP Address..." option, I am able to connect.
Right-click on the device name(Under Disconnected list) and choose "Connect via IP Address...." option.
Type the IP address of the device and chose Connect. (you can find through mobile device Settings > Wi-Fi > Choose the wifi name)
If you have completed all steps given by Surjeet and still not getting network connection icon then follow below steps:
Unpair Device using right click on the device from the Connected section.
Reconnect the device.
Click on "+" button from the end of the lefthand side of the popup.
Select the device and click on next button
Click on Trust and passcode(if available) from the device.
Click on Done button.
Now, click on connect via network.
Now you can see the network connection icon after the device name. Enjoy!
Prerequisite
Your Mac Machine should have at least Mac OSX 10.12.4 or later
Your iOS device should have at least iOS 11.0 or later
Both devices should be on same network.
Steps to Activate
Plug your iOS device with Mac machine from cable.
Open Xcode then from top menu Window -> Devices and Simulators
Chose Devices segment and chose your desired Device from left device list.
On right side you can see open Connect via network, enable this option as shown in attached image.
After few seconds you can see network sign in front of you device.
Unplug your device and use debugging as you're using normally.
Thanks
If after following the steps as described by Surjeet you still can't connect, try turning your computer's Wi-Fi off and on again. This worked for me.
Also, be sure to trust the developer certificate on the iOS device (Settings - General - Profiles & Device Management - Developer App).
Network debugging requires Xcode 9.0 or later running on macOS 10.12.4
or later, and on the device, requires iOS 11.0 or later, or tvOS 11.0
or later.
iPhone
iOS 11 won't be available for 32bit devices, i.e. iPhone 5 and iPhone 5c and below. The first 64bit iPhone is 5s.
iPad
iPad mini 2 will be the oldest iPad with iOS 11 support.
iPod
iPod needs to be an iPod 6 to be able to run iOS.
If you use your devices not only for developing but also for production, be warned that a beta OS is not for the faint hearted ;-)
In the new Xcode9-beta, we can use wireless debugging as said by Apple:
Cut the Cord
Choose any of your iOS or tvOS devices on the local network to install, run, and debug your apps – without a USB cord plugged into your Mac. Simply click the ‘Connect via Network’ checkbox the first time you use a new iOS device, and that device will be available over the network from that point forward. Wireless development also works in other apps, including Instruments, Accessibility Inspector, Quicktime Player, and Console.
Try this!
If facing disconnection issues, try this:
Workaround: Enable airplane mode on your device for 10 seconds and then disable airplane mode to re-establish your connection
I just talked to some Xcode engineers at WWDC and the auto discovery of iDevices is still a little buggy. Also sometimes your phone is not correctly broadcasting. Switching your device on and off can help.
There are a few workarounds/fallbacks:
You can check if your phone is broadcasting with Bonjour Browser (www.tildesoft.com). Look if your wifi address is listed under the service called '_apple-mobdev2._tcp. - 215' (you can find your wifi address here: settings > general > about > wifi address.
As a fallback you can connect to your device by manually entering the IP address (right click on your devices in the Devices window).
However this IP address will be persisted, so if you change networks you'll need to reset this. That option is not available in Xcode yet, but you can do it via the terminal with the following command:
defaults read com.apple.dt.Xcode | grep IDEIDS
This will print an identifier which you need to use in the next command:
defaults delete com.apple.dt.Xcode <identifier>
Now the ip address is cleared and you can enter a new one.
The last option is to create a computer-to-computer network. This works fine, but logically you won't have internet access then.
Try this:
Plug your iOS device into your Mac using a lightning cable. You may need to select to Trust This Computer on your device.
Open Xcode and go to Window > Devices and Simulators.
Select your device and then select the Connect via network checkbox to pair your device.
Run your project after removing your Lighting cable.
You can open Xcode Help -> Run and debug -> Network debugging for more info. Hope it helps.
i followed all the suggested steps, in particular the ones provided from ios_dev but my iPhone was not recognized from Xcode and i was not able to debug over WiFi. Right click on the left panel over my iDevice in "Devices and Simulators" window, then "Connect via IP Address...", inserted the iPhone IP and now it correctly works
For wireless debugging, Mac system and iPhone/Device should be on same network.
For making on same network you can do as -
Either you can start hotspot on Mac & connect that on iPhone/Device or vice versa.
On Mac
OR
On iPhone-
Xcode ► Window ► Devices and Simulators ► select devices Tab ► click connect
via network
https://help.apple.com/xcode/mac/9.0/index.html?localePath=en.lproj#/devbc48d1bad
My problem was about network SSID broadcasting.
I've tried all the solutions above but still couldn't connect my device, there was no 'globe' icon for my device at all. Then I found that for some reason my network had turned its SSID broadcasting off(tho I could still connect the network by inputing the SSID manually). Once I turned the SSID broadcasting on, I could connect my device via 'Connect via IP Address...'.
I tried all answers but nothing worked for me. I ended up connecting to different WiFi network then I was able to debug wirelessly.
I have no clue why it didn't work with the old network
The only thing that worked for me was to connect my phone to my MacBook using Bluetooth. (I did this after first pairing my phone with Xcode while connected via cable per ios_dev's answer above.)
On my phone, I went to Settings > Bluetooth and tapped my MacBook's name under "MY DEVICES" to connect.
I then went to Xcode > Devices and Simulators, selected my phone and checked "Connect via network". After a few seconds, the globe icon appeared next to my phone and I could run and debug my app on my phone.
This worked even when my MacBook was connected to a WiFi network and my phone was using LTE. The only downside is that it was quite slow installing the app to the phone.
Xcode 9 - For detailed info goto Help -> Pair a wireless device with Xcode (iOS, tvOS)
The only way I could get it to work is if my Mac and my iPhone were on different networks. I have a main DSL modem call it network1 and a second network2 setup us an access point. They have SSIDs network1 and network2. If the phone was on network1 and the mac on network2 it would work, or vice versa. But if both were on network1 or both were on network2, it would NOT work.
Enable Internet Sharing using USB ports:
LOL, I was doing all the steps here - I ended up doing the unpairing/repairing steps from the "given by Surjeet" answer. It didn't work, and then I noticed that when I clicked the "connect via network" button, the same yellow box would pop up that pops up when you repair, saying "busy" - I got frustrated and just started hammering the "connect via network" button, clicking it quickly for probably like 15 - 20 clicks - it started spazzing out, but eventually landed on being able to connect to the network. Before that worked, I also shut my wifi off and turned it on again, as suggested by one of these answers, but clicking the "connect via network" button really fast did the trick...LOL
Also, before I hammered the button, I linked the device support folders, although I'm not sure if it did anything:
open the terminal
cd
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
ln -s 13.3 13.4
ls -l 13.4
restart Xcode and retry run on device
Said to do it here - https://forums.developer.apple.com/thread/126940 - I edited the folder version in my comment to adjust to the latest version of iOS 13.4.
EDIT
I believe I figured out what my problem was, I had to stop my Little Snitch network filter. Also, after I was able to connect by hammering the button, the "connect via IP address" option appeared in the dropdown when you right click on the device in the devices manager in xcode, it wasn't there before I was able to connect ultra-hacky style the first time. If I connect, and then turn my network filter on, it disconnects my phone.
Step 1 : First time connect phone with Cable
Step 2 : Go to Organizer & Devices
Step 3 : Tick Connect as Network
Now simple trick which works everytime.
Step 4 : Turn on hotspot on iphone
Step 5 : Connect your mac with that hotspot.
Step 6 : Now run the code.
This will always work.

How do you perform wireless debugging in Xcode 9 with iOS 11, Apple TV 4K, etc?

Wireless debugging was recently added as a feature in Xcode 9, iOS 11, and tvOS 11. Apple TV 4K doesn't have a USB port, so it requires wireless debugging. How do you perform this wireless debugging in Xcode?
Set up a device for network debugging
from help.apple.com
Debug your app running on an iOS or tvOS device over a Wi-Fi or other network connection.
Steps to set up iPhone, iPad, or iPod touch
Check that your device has a passcode and add one if it doesn't. Your device must have a passcode to enable remote debugging
The Mac and the iPhone/iPad need to be on the same network to use wireless debugging.
Next, in Xcode
Choose Window > Devices and Simulators, then in the window that appears, click Devices.
Connect your device to your Mac with a Lightning cable.
In the left column, select the device, and in the detail area, select Connect via network.
Xcode pairs with your device. If Xcode can connect with the device using a network, a network icon appears next to the device in the left column.
Disconnect your device.
Now you are ready for debugging over the network.
Sometimes it doesn't work. You might need to restart the device or network connection.
Note: Network debugging requires Xcode 9.0 or later running on macOS 10.12.4 or later, and on the device, requires iOS 11.0 or later, or tvOS 11.0 or later.
Steps to set up Apple TV:
Make sure your Mac and your Apple TV are on the same network.
Choose Window > Devices and Simulators, then in the window that appears, click Devices.
On your Apple TV, open the Settings app and choose Remotes and Devices > Remote App and Devices.
The Apple TV searches for possible devices including the Mac. (If you have any firewall or Internet security, disable/turn it off to allow searching.)
On your Mac, select the Apple TV in the Devices pane. The pane for the Apple TV is displayed and shows the current status of the connection request.
Enter the verification code displayed on your AppleTV into the Device window pane for the device and click Connect.
Xcode sets up the Apple TV for wireless debugging and pairs with the device.
I have tried using Xcode Devices window's Connect via network options. but I am unable to see the "Connected over the network" icon next to the device name. also as soon as remove the USB the "Connect via network" option disappeared. also, the device name appears under the disconnected device list.
But using the "Connect via IP Address..." option, I am able to connect.
Right-click on the device name(Under Disconnected list) and choose "Connect via IP Address...." option.
Type the IP address of the device and chose Connect. (you can find through mobile device Settings > Wi-Fi > Choose the wifi name)
If you have completed all steps given by Surjeet and still not getting network connection icon then follow below steps:
Unpair Device using right click on the device from the Connected section.
Reconnect the device.
Click on "+" button from the end of the lefthand side of the popup.
Select the device and click on next button
Click on Trust and passcode(if available) from the device.
Click on Done button.
Now, click on connect via network.
Now you can see the network connection icon after the device name. Enjoy!
Prerequisite
Your Mac Machine should have at least Mac OSX 10.12.4 or later
Your iOS device should have at least iOS 11.0 or later
Both devices should be on same network.
Steps to Activate
Plug your iOS device with Mac machine from cable.
Open Xcode then from top menu Window -> Devices and Simulators
Chose Devices segment and chose your desired Device from left device list.
On right side you can see open Connect via network, enable this option as shown in attached image.
After few seconds you can see network sign in front of you device.
Unplug your device and use debugging as you're using normally.
Thanks
If after following the steps as described by Surjeet you still can't connect, try turning your computer's Wi-Fi off and on again. This worked for me.
Also, be sure to trust the developer certificate on the iOS device (Settings - General - Profiles & Device Management - Developer App).
Network debugging requires Xcode 9.0 or later running on macOS 10.12.4
or later, and on the device, requires iOS 11.0 or later, or tvOS 11.0
or later.
iPhone
iOS 11 won't be available for 32bit devices, i.e. iPhone 5 and iPhone 5c and below. The first 64bit iPhone is 5s.
iPad
iPad mini 2 will be the oldest iPad with iOS 11 support.
iPod
iPod needs to be an iPod 6 to be able to run iOS.
If you use your devices not only for developing but also for production, be warned that a beta OS is not for the faint hearted ;-)
In the new Xcode9-beta, we can use wireless debugging as said by Apple:
Cut the Cord
Choose any of your iOS or tvOS devices on the local network to install, run, and debug your apps – without a USB cord plugged into your Mac. Simply click the ‘Connect via Network’ checkbox the first time you use a new iOS device, and that device will be available over the network from that point forward. Wireless development also works in other apps, including Instruments, Accessibility Inspector, Quicktime Player, and Console.
Try this!
If facing disconnection issues, try this:
Workaround: Enable airplane mode on your device for 10 seconds and then disable airplane mode to re-establish your connection
I just talked to some Xcode engineers at WWDC and the auto discovery of iDevices is still a little buggy. Also sometimes your phone is not correctly broadcasting. Switching your device on and off can help.
There are a few workarounds/fallbacks:
You can check if your phone is broadcasting with Bonjour Browser (www.tildesoft.com). Look if your wifi address is listed under the service called '_apple-mobdev2._tcp. - 215' (you can find your wifi address here: settings > general > about > wifi address.
As a fallback you can connect to your device by manually entering the IP address (right click on your devices in the Devices window).
However this IP address will be persisted, so if you change networks you'll need to reset this. That option is not available in Xcode yet, but you can do it via the terminal with the following command:
defaults read com.apple.dt.Xcode | grep IDEIDS
This will print an identifier which you need to use in the next command:
defaults delete com.apple.dt.Xcode <identifier>
Now the ip address is cleared and you can enter a new one.
The last option is to create a computer-to-computer network. This works fine, but logically you won't have internet access then.
Try this:
Plug your iOS device into your Mac using a lightning cable. You may need to select to Trust This Computer on your device.
Open Xcode and go to Window > Devices and Simulators.
Select your device and then select the Connect via network checkbox to pair your device.
Run your project after removing your Lighting cable.
You can open Xcode Help -> Run and debug -> Network debugging for more info. Hope it helps.
i followed all the suggested steps, in particular the ones provided from ios_dev but my iPhone was not recognized from Xcode and i was not able to debug over WiFi. Right click on the left panel over my iDevice in "Devices and Simulators" window, then "Connect via IP Address...", inserted the iPhone IP and now it correctly works
For wireless debugging, Mac system and iPhone/Device should be on same network.
For making on same network you can do as -
Either you can start hotspot on Mac & connect that on iPhone/Device or vice versa.
On Mac
OR
On iPhone-
Xcode ► Window ► Devices and Simulators ► select devices Tab ► click connect
via network
https://help.apple.com/xcode/mac/9.0/index.html?localePath=en.lproj#/devbc48d1bad
My problem was about network SSID broadcasting.
I've tried all the solutions above but still couldn't connect my device, there was no 'globe' icon for my device at all. Then I found that for some reason my network had turned its SSID broadcasting off(tho I could still connect the network by inputing the SSID manually). Once I turned the SSID broadcasting on, I could connect my device via 'Connect via IP Address...'.
I tried all answers but nothing worked for me. I ended up connecting to different WiFi network then I was able to debug wirelessly.
I have no clue why it didn't work with the old network
The only thing that worked for me was to connect my phone to my MacBook using Bluetooth. (I did this after first pairing my phone with Xcode while connected via cable per ios_dev's answer above.)
On my phone, I went to Settings > Bluetooth and tapped my MacBook's name under "MY DEVICES" to connect.
I then went to Xcode > Devices and Simulators, selected my phone and checked "Connect via network". After a few seconds, the globe icon appeared next to my phone and I could run and debug my app on my phone.
This worked even when my MacBook was connected to a WiFi network and my phone was using LTE. The only downside is that it was quite slow installing the app to the phone.
Xcode 9 - For detailed info goto Help -> Pair a wireless device with Xcode (iOS, tvOS)
The only way I could get it to work is if my Mac and my iPhone were on different networks. I have a main DSL modem call it network1 and a second network2 setup us an access point. They have SSIDs network1 and network2. If the phone was on network1 and the mac on network2 it would work, or vice versa. But if both were on network1 or both were on network2, it would NOT work.
Enable Internet Sharing using USB ports:
LOL, I was doing all the steps here - I ended up doing the unpairing/repairing steps from the "given by Surjeet" answer. It didn't work, and then I noticed that when I clicked the "connect via network" button, the same yellow box would pop up that pops up when you repair, saying "busy" - I got frustrated and just started hammering the "connect via network" button, clicking it quickly for probably like 15 - 20 clicks - it started spazzing out, but eventually landed on being able to connect to the network. Before that worked, I also shut my wifi off and turned it on again, as suggested by one of these answers, but clicking the "connect via network" button really fast did the trick...LOL
Also, before I hammered the button, I linked the device support folders, although I'm not sure if it did anything:
open the terminal
cd
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
ln -s 13.3 13.4
ls -l 13.4
restart Xcode and retry run on device
Said to do it here - https://forums.developer.apple.com/thread/126940 - I edited the folder version in my comment to adjust to the latest version of iOS 13.4.
EDIT
I believe I figured out what my problem was, I had to stop my Little Snitch network filter. Also, after I was able to connect by hammering the button, the "connect via IP address" option appeared in the dropdown when you right click on the device in the devices manager in xcode, it wasn't there before I was able to connect ultra-hacky style the first time. If I connect, and then turn my network filter on, it disconnects my phone.
Step 1 : First time connect phone with Cable
Step 2 : Go to Organizer & Devices
Step 3 : Tick Connect as Network
Now simple trick which works everytime.
Step 4 : Turn on hotspot on iphone
Step 5 : Connect your mac with that hotspot.
Step 6 : Now run the code.
This will always work.

jquery mobile application works in chrome simulator but not in actual device

We have a ASP.net web application integrated with DotNetNuke.
The mobile version uses jQuery mobile 1.6.X.
While trying to test the application it works well in Chrome simulator(our staging environment is publicly exposed). But it does not work in any of the actual device.
Can anyone suggest how to debug this ?
For Android you can attach the device to the pc and go to chrome-> developer tools -> inspect devices
Make sure your phone is set to developers mode with usb debugging on.
For iOS you can attach your phone to a mac and open safari, develop menu and then the device you want to inspect.
There you will find the javascript console, source, style and everything you normally need for website debugging.

Resources