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.
Related
I am developing an appleTv app with Xcode.
Every time, I leave appleTv untouched for a long period of time (an hour or so), it gets disconnected:
This is the error:
Failed _shouldMakeReadyForDevelopment check even though device is not
locked by passcode.
allowsSecureServices: 1. isConnected: 0. Platform:
DVTPlatform:0x7fd21e57e7a0:'com.apple.platform.appletvos':<DVTFilePath:0x7fd21e57f5a0:'/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform'>.
DTDKDeviceIdentifierIsIDID: 0
So when I try to build, I get stuck in here:
This is making developing a tvOS app near impossible, since so much of my time is spent debugging why the appleTv is not correctly paired/connected to my MAC.
NOTE1: I've tried unpairing&pairing again, restarting the appleTv and the MAC, resetting the appleTv and still no result.
NOTE2: I have the latest Xcode version installed.
NOTE3: Similar questions have been asked on StackOverflow but none of them tackled the tvOS problem in particular. And I have also tried their proposed solutions.
NOTE4: AppleTv is connected to my MAC through wifi.
I ran into this and found that leaving Xcode on the "is not connected" dialogue and turning the Apple TV off and on fixed it. (I have both my mac and AppleTV connected to the same switch via ethernet.)
I also have a factory-reset Apple TV with no PIN. It's possible there's some configuration that prevents this from working for you. Maybe a factory reset would fix it?
Edit: After developing with the Apple TV 4K UHD for a month, I have frequent issues like this, but not always the same. Usually I can't connect and need to re-pair (even though it's already paired). Sometimes pairing appears to succeed, but the device isn't usable. Sometimes even restarting my mac and tvos fail to resolve the problem.
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...
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.
This is happening intermittently, but frequently iOS devices are connecting to my MacBook Pro (mid-2014) and then quickly disconnecting. Without any clear error or log to indicate why.
Where should I look for event logs that may help indicate what the underlying error is? I've tried to look through console logs for system events but I haven't seen anything that jumps out.
I've gone through many of the recommended solutions for Xcode not recognizing iOS devices:
Clean Project
Delete DerivedData folder
Restart Xcode
Restart the Mac
Restart the iPhone
Reset device permissions to re-trigger the "Trust Computer" prompt
Deleted iOS DeviceSupport folder
Alternated USB ports
Kill USB process
Deleted and re-installed the latest version of iTunes
Swapped out 4 different lightning cables
Tried 5+ different iOS devices with various versions of the OS
Went back to Xcode 8.2.1 to see if it was an issue with 8.3.1
Corporate IT reset my SMC this morning. I put in a request to have them disable Sentinel Agent to see if that's a factor, but it's not the clear culprit since other developers are still able to connect.
Very rarely, the connection will hold and I can use the device just fine. I have yet to determine what combination of astrological events leads to that case though.
Had the same issue and tried 10+ of the things you listed as well. Even tried uninstalling a few things that could have been interfering. As soon as I switched USB ports it worked and stayed connected. Turned out to be lint/dust in the USB port. A little duster in the port and it works like a charm. Sometimes the answer is so simple.
This is a disappointing solution, but IT reimaged my machine and the device connection has been stable ever since.
So if all else fails for you, start over.
Update:
This ultimately was narrowed down to an issue with Mobile Labs Device Bridge. Removing their launch daemons and restarting the system is the much simpler solve!
Some testers warned me about an issue that will rise when my app is becoming active from background when the device is restarted. I can replicate the issue, but it's hard to debug because obviously Xcode looses connection to my device when it is turned off and don't reconnect automatically to it when it is turned on again.
To get the reconnection, I have to unplug the device from the USB cable, plug it again and build and run from Xcode. The problem is that this will cause the app to restart and the issue disappears.
How am I supposed to overcome this problem?