How to Catch the Mysterious Error Which Appears Only in TestFlight
Read about the bug that was causing this otherwise successful mobile application to fail, but only when installed from TestFlight.
Join the DZone community and get the full member experience.
Join For FreeLet me share my story about a bug which was driving me crazy for a week.
I made some modifications in my app, tested it on simulators, even a device, and I sent the latest build for the internal TestFlight. When I installed the app on the same device I used to use for testing from Xcode, at a certain point, the app went to the background, showing me the Home screen. I could see the app in the task switcher, which was actually properly showing the desired state of the application. When I tapped on it to bring it forward as the main running app, the app went to the initial state, showing me the initial view controller. WTF? So I started the investigation with the steps below.
#1 Downloading the Log Files From Your Device
I thought, let’s investigate a bit… I connected my iPhone to my Mac, and started the devices from Xcode -> Window -> Devices. Here, I could see my phone, and be able to download the log files. I found nothing. Since I removed all of the NSLog entries from my code, there wasn’t even a log file from my application, so whatever was happening with the app, it hadn’t been logged.
#2 Using Fabric and Crashlytics
My next try was with Fabric and Crashlytics; maybe it could catch something. I added them to my project and started to work with them. The result? Nothing…
#3 Connecting the Phone…
Since I was running out of ideas, I connected my iPhone again, and started the app from Xcode. It was working, of course, since my iPhone was like all of the other simulators. If I installed the version from TestFlight, the problem appeared again.
#4 Eureka!
I started to think what is the difference between the different methods I used to deploy the app to my iPhone, and finally, something clicked about the Release and Debug builds.
By default, Xcode compiles, deploys, and starts your app with Debug executable enabled, when you run it on the device or on the simulator from Xcode. When you upload your app into iTunes Connect, the app will be recompiled with the Release mode. And that made a huge difference in my case.
At least I would be able to run the app with my device connected, and in the Console, I could see only one last screen from my app, which helped me to hunt down the bug.
How to Setup to Run in Release Mode
The main topic here is the Scheme, which is available under the Product menu point. In order to have the finally released build running on your device, you have to set up the scheme by the following:
Under the Run/Run:
– Build configuration: Release
– Untick Debug executable.
Keep in mind that although you are able to select the device (see the top left corner on the screen), it seems that is not the case. If you change the scheme, it will be applied for all of your devices. So when you finished with your testing, it is better to change it back to the default:
– Build configuration: Debug
– Tick Debug executable.
Published at DZone with permission of Peter Molnar, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Trending
-
Building a Flask Web Application With Docker: A Step-by-Step Guide
-
Reactive Programming
-
Auditing Tools for Kubernetes
-
Scaling Site Reliability Engineering (SRE) Teams the Right Way
Comments