How can I keep debug on when device is turned off? - ios

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?

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.

How can I enable logging to Xcode->Device manually on deployed iOS apps?

I'm trying to capture some log that's leading to a crash of the app. I can't reproduce this issue other than on production (deployed on app store). I tried adding NSLog to watch it in Xcode devices when the issue happens but NSLog gets called pretty frequently (once a second), uses too much CPU and the phone becomes hot. So I want to only enable logging when the device is plugged into XCode. Is there any way I can manually enable logging?
Thanks

Build lags for a full minute on "Performing Install Actions"

Today, my builds suddenly started taking a long time to install & launch on my iPad (using XCode 7). During the "Performing Install Actions" phase, it hangs for about a minute, and then when the launch screen shows on the device, it takes about another minute for the app to launch. After the app launches, it runs normally without any issues.
I've restarted Xcode, cleaned the app, deleted build folders, deleted DerivedData, restarted OSX, restarted iOS, deleted the app from my iPad, and even upgraded iOS on the iPad to 9.0.2.
Edit: This issue originally seemed to be specific to the iPad Mini 3 I was using; it didn't happen on the iPhones I'm testing with. Now, after the weekend, it's happening on an iOS 8.4 iPhone 5s that I'm also developing on.
Edit 2: This was happening sporadically yesterday and it now seems to have cleared itself up, on all my devices. Still no idea what steps to take to fix this if it happens, though.
Edit 3: It continues to happen, but much more rarely.
I've been dealing with this same thing, but connecting the phone to WiFi seems to unblock my installs. Who knows why... but give that a shot if you're still running into this issue.
I recently ran into this problem and resolved it by restarting the device. I have no idea of what the cause is so I am reticent to suggest this is a universal solution but it did work for me once in a row.
Fix : Turn off iPhone wifi. restart it and install the app now. Now you turn on the wifi. and it works. Fixed.
I had a similar problem, but for me the app wouldn't launch at all. This might have been happening because I was connected to a WiFi that didn't have internet access. Changing to a WiFi with internet access solved the problem for me. It started happening suddenly for me as well, so not sure what triggers it. I've now changed back to the WiFi without internet access, and it seems to work again.
I met this problem in Company, but not at home, when debugging on device.
So if you are working under a company WIFI, just Changing WiFi to Internet Access will solve the problem.
I had the same problem just now.
What does NOT work for me:
Restart Xcode
Clean the project
Unpair and reconnect the device
(Re)connect to wifi
What DOES work for me:
Restart the device and build again
Another possible cause is low disk space on your Mac. Make sure your mac has enough space - I was running with 13mB space remaining... This will impact cacheing etc. and will cause delays on your build.
I have this issue when my Apple Watch are on me. Maybe some problems with paired devices.

Debugging app on a specific device causes app to crash and Xcode to lose connection to device

We are testing our app on several iPhone 6 Pluses, and at some point we are using GPUImage to capture some images. On my device, it works fine, but on my friend's device, it causes app to crash and Xcode to lose connection to device. It's not like an exception where you hit a breakpoint. Connection to device is lost completely for a split second, just as we've quickly unplugged and replugged the lightning cable (no, we haven't, obviously). There are no errors or warnings at Xcode console, it's exactly like we've unplugged the device, therefore I have no idea why the error occurs. Other than that, the app works normally, and if there are crashes, it 'crashes' normally (hitting a breakpoint on Xcode normally). The bug apparently happens only on camera launch and/or when user takes a photo. Why would that happen? Is it a hardware issue (the device's camera works normally though), or if not, what can I do to find the cause of the problem?
I would suggest taking a look at any memory issues that may be causing the crash. I'm having a similar problem and determined that I was having memory problems by assessing Allocations while profiling the app using Instruments:
https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/Introduction/Introduction.html

Using instruments on my ios 5.0.1 iphone4 phone makes it reboot right away

I'd like to understand why, and find a solution obviously. I can't figure it out, given the console disappears as soon as the device reboots and is then reset when it comes back from the reboot. So I don't have any clue of what's going on there.
iphone4, ios 5.0.1 installed, jailbroken when the latest redsnow & untethered JB. I tried in safe mode, same thing.
I noticed that everytime I connect the phone osx mounts a developerdiskimage volume while xcode is displaying "checking DDI symbols", and after that then the phone is considered valid for dev by xcode. After the phone just rebooted, it's shown as invalid for development in xcode, until I unplug / replug it. I don't think I ever noticed that before, could it be related?
With the new ios 5.1.1 jailbreak out. You might want to revisit it again. I had a similar problem where I could mesure leaks but trying to mesure CoreAnimation or anything else would restart the device.

Resources