How to debug an app on iPhone without internet - ios

I'm using Xcode 10.1, and I don't have a checkbox whether I want to connect through network or not on my device page (which was there in Xcode 9 and Xcode 10 beta). Search "connect via network xcode" on google images if you don't know what I mean.
However, I must debug the offline flow of my app (which is written in React-Native btw). Not just no-internet-connection, but turning off wifi and mobile-data, which will trigger a status change. By using the developer settings of the iPhone, I can make every call fail (100% loss), but cannot change the internet-status of the phone.
So I want the debugger to stay connected and either be able to:
debug the old-school way through the cable (if I turn off internet now, I get a red error screen and nothing is possible anymore), so I can disable wifi and mobile-data,
or simulating that status change on the phone.
Btw, I cannot use a simulator, since the app requires Bluetooth.
Thanks in advance!
Edit:
The checkbox is not there for older iPhone devices. With iPhone 7s, I do see the checkbox "connect via network". But enabling or disabling does not change the fact that your iPhone needs internet to debug. If I disable internet on the phone I get the following error:

Ok, I've found the problem. We are testing on a iPhone5, which is no longer officially supported by Apple. Which means that Apple has decided to cut features for iPhone5 so you would buy a new one (wonderful strategy =/). Hence debugging with a cable is no longer supported on iPhone5.
We tested with a iPhone6 from a colleague, and everything works fine.
Edit:
Altough the checkbox is there, and I can disable wifi for connection... The moment I turn off internet on the phone, the app crashes and says: "Runtime is not ready for debugging: make sure packager runtime is running"... so no solution yet...

Related

iPhone disconnected USB connection overnight and there are no system logs

I needed to run a long test to see what's making my app crash. So I set the Mac to not sleep and I ran the app on the iPhone connected via USB overnight. In the morning, I found that the iPhone had disconnected during the night.
I looked for in Console and Xcode for device logs and I found there were none at all on the phone, therefore no history of what happened during the night. Logs began after the moment I reconnected the phone to the Mac.
I downloaded the app container and found no useful evidence of what happened.
iOS is 12.4 and Xcode is 10.3.
What can be done to ensure there is some evidence of what caused the crash? Other than filling the app with fprintf's going to a custom log file. Also I am using Fabric.
Do the same thing again, but this time with a camera looking at the PC. Maybe you can grab some evidence from the recording next day. Modern solutions for modern problems.
Go to Settings -> Touch ID and Passcode
Check if USB Accessories has been turned off. Your device may have disconnected then failed to reconnect due to this feature restricting access to the device if it is disconnected for more than an hour.
Change this setting, replace your cable or use a different USB port then try running it again.

Xcode 9 Wireless debugging not working

For some reason the wireless debugging does not work here. Here is what I've done:
Using newest Xcode 9
Using newest iOS 11 on my iPhone 7+
Both devices are in the same network
Connected the iPhone via Lightning, selected "Connect via Network" in the Devices & Simulator menu
Run an app on the iPhone while still connected via Lightning - everything works
But as soon as I unplug the phone, Xcode is no longer able to connect with the phone. I can ping the phone with the Mac, but even the "connect via ip" option in Xcode does not work.
Anybody got tips on how to get this working?
I had the same issue, but it was intermittent - i.e. sometimes the globe would not appear next to the phone name in Xcode Devices and Simulators window and when the phone was disconnected from the lighting cable, I could not debug to it from Xcode. My fix was much simpler, though - I just turned WiFi on and off both on the Mac and on the phone. After the devices reconnected to the network wireless debugging was available again. This seems to be an issue with the network communication (regardless whether the device can be pinged or not).
Make sure System Preferences->Internet Sharing is enabled using USB ports:
I was able to find a solution to this on another stack overflow question:
How do you perform wireless debugging in Xcode 9 with iOS 11, Apple TV 4K, etc?.
You can also check this answer: "Connect via network" wireless debugging not working Xcode 9
Near the bottom, from "IOS DEV". Briefly, the solution ended up to be to unpair my phone, disconnect and re-pair. After that Xcode automatically added it with the globe. As an FYI, I was able to ping my iPhone using the network utility prior to the un-paring but was still unable to get the phone to connect. good luck.
Restarting xcode is the only thing that fixed this intermittent connectivity problem for me.
I realized this can also happen if my Mac is connected to a VPN. I had to:
Kill the VPN connection
Turn the computer's wifi off and back on
Open Devices and Simulators
Plug the device in and the globe icon should appear.
Unplug the device and make sure the globe icon is still there.
Run the app via network!
Wireless debugging mysteriously stopped working for me until I turned off my VPN client. I now believe that I had the VPN turned off when I was trying it out the first time, but then the VPN auto-connected after my computer restarted sometime later.

Is there a way to prompt a user to turn on/off WiFi in iOS from an Alert?

I have this problem where when I go out my iPhone 6s on iOS 9.3.4 tries to connect to every hotspot I pass. Then when it is trying to connect I can't get emails/texts/alerts etc. My solution has been to turn off WiFi. But then I get home again and forget to turn it back on and I wonder why my internet is so slow until I remember to turn WiFi back on. I got the idea for an app to build a geofence around my house and turn off WiFi when I leave that area. I know I can't do this automatically because of the iOS sandboxing restriction, but can I pop an alert when I cross the geofence boarder that asks if I want to turn WiFi on/off?
I haven't found anything current that allows me to do this. I have searched extensively and only found "Stumbler" but it appears to be from 2007. I only know C# and do all my app development in Xamarin so C# code would be best or if you know of any libraries/components/plugins.
Also, I just want this app for myself so no need to submit to app store.
Thanks,

Is automatic screen mirroring broken in or removed from iOS 6+?

I want to do this with my app and device:
Connect VGA, DVI, or HDMI monitor to appropriate 30-pin adapter cable
Connect adapter to iPhone4/iPad2
Mirror iDevice screen content on monitor screen.
This all used to "just work" on iOS 5. There's even proof of it working in a YouTube video of our demo from last year (see http://youtu.be/xjKk1EJ1yAI, to skip to the image jump to 1:40 in the video and hit play). All I did was plug in the iPad and voila there it was...
This now seems to "just not work." Do I have to write a whole bunch of code to make this work with every app I build or is there a setting in the Info.plist file that I should set? Should I build for iOS 5.1 to make it work again, even though the device runs iOS 6+?
I will write the code if I have to, but I'd be a lot happier if it just worked again. The "similar questions" feeature on SO was helpful in letting me know that I'm perhaps out of luck and pointing to some solutions, like Rob Terrell's TVOutManager, but I wasn't able to find an answer to this specific question in that list.
EDIT: I only tried this with an iPhone 4 running iOS 6.0.1 and the VGA adapter. I haven't tried again with an iPad (also with iOS 6.0.1), and the video was using the HDMI adapter. I will try those and update accordingly (but probably not until Monday for those updates).

AIR mobile debug - "Enter ip address or hostname"

I'm developing a mobile app using Flash Builder 4.6/AIR. I've been able to debug on the device (an iPhone 4s) just fine until now. I connect my iPhone to my mac with the USB corad, and debug.
All of a sudden I'm getting a black screen for close to a minute. Then I see the "Enter ip address or hostname" dialog. If I enter the ip address of my machine it doesn't matter. The window goes away for about 15 seconds, then comes back. Meanwhile, Flash Builder on my mac times out. The only way I can actually see the program running is if I hit 'Cancel' on that dialog. The app then launches, but I cannot set any breakpoints, cannot debug.
Everything I've found on the internet around this issue mentions it in reference to AIR for android -- not iOs. But I'm seeing it with iOs.
Anyone know what's going on here?
Thanks.
To make it easier for future readers, the official answer to this issue;
With the current (official) version of the AIR SKD (3.2) USB debugging is not supported on iOS devices. This is going to change with the future 3.3 release which (amongst others) adds USB debugging support:
"USB debugging for AIR iOS
This new feature allows the iOS developer to connect to the desktop via USB while debugging their mobile applications instead of relying on network connectivity."
With version 3.2, iOS debugging works over the local network, so both devices (the machine the debugger runs on and the iOS device) have to be in the same network so that they can communicate with each other.
See also the reply to What is the address of my Flash debugger?, it really helped me to resolve similar issue. Using 'ios-debug' mode was the way to go.
If you still have this problem using Android with the device connected to same wifi, try checking firewall rules. In my case FlashDevelop was blocked and I didn't suspected because of updates worked perfectly.

Resources