I've got an app that runs perfectly well when run from the debugger. When uploading to TestFlight it goes through fine and am able to download using the Testflight app.
However, the moment I launch the app, it displays the splash for 20 or so seconds before closing. No crash report as such is generated but was able to extra a '.ips.beta' file from CrashReporter and it looks like this:
Exception Type: 00000020 Exception Codes: 0x000000008badf00d Exception Note: SIMULATED (this is NOT a crash) Highlighted by Thread: 0 Application Specific Information: com.some.app failed to launch after 20.00s (launchIntent: foreground-interactive) Elapsed total CPU time (seconds): 30.760 (user 30.760, system 0.000), 77% CPU Elapsed application CPU time (seconds): 0.080, 0% CPU Filtered syslog: None found Thread 0 name: Dispatch queue: com.apple.libdispatch-manager Thread 0: 0 libsystem_kernel.dylib 0x3805e3c0 0x38048000 + 91072 1 libdispatch.dylib 0x37f749a6 0x37f64000 + 68006 2 libdispatch.dylib 0x37f66b2e 0x37f64000 + 11054 Thread 1 name: Dispatch queue: com.apple.root.default-qos.overcommit Thread 1: 0 libsystem_kernel.dylib 0x3805d54c 0x38048000 + 87372 1 libdispatch.dylib 0x37f727f0 0x37f64000 + 59376 2 libdispatch.dylib 0x37f727da 0x37f64000 + 59354
I can see it says '8 bad food' and that it's closing before it's able to initialize - but - it produces no statements in the console, and it's running absolutely perfectly on a device when run using the Debugger or even when I install a Adhoc copy (manually from Xcode or using Fabric). Why would it fail only when coming from TestFlight? How do I go about debugging this when it's working fine otherwise. It's failing on every device that it otherwise is able to run using the debugger.
I have even tried putting a NSLog statement in the main() method before the delegate gets passed control - that doesn't get logged to the console (I'm using the Device Manager to see raw device logs). Furthermore, every time I launch the app, I see this before the app closes:
AppName[640] : Bogus event received by listener connection: { count = 1, contents = "XPCErrorDescription" => { length = 18, contents = "Connection invalid" }
What does this mean?
UPDATE: Please see my comments below - it's not the app, it's TestFlight.
I looked at one particular report of this problem, and my preliminary conclusion is that there is a problem when there is an app extension with the same name as the main executable file for the app. If you're seeing this problem, you can try renaming one of those so that they have distinct names. There's a good chance that will avoid the problem.