title: iOS Application Will not Launch From Adhoc Distribution Because It can't find XCTest Framework
body: <p>I made a <a href="https://stackoverflow.com/questions/22261753/ios-app-wont-start-on-testflight-ad-hoc-distribution">post</a> before about this problem, but since then I've been able to find some crash logs on some testers' devices. </p>
  
  <p>Interestingly the count of crash logs on the device do not match the number of crashes, but still, this may be a clue. </p>
  
  <p>Long story short, when I distribute my application to testers via TestFlight, then can't open the app: it closes before anything can happen (I know this because there are no TestFlight crash logs). All the on-device logs I've managed to find point to the same problem: </p>
  
  <pre><code>Exception Type:  EXC_BREAKPOINT (SIGTRAP)
  Exception Codes: 0x0000000000000001, 0x0000000120085098
  Triggered by Thread:  0
  
  Dyld Error Message:
    Library not loaded: /Developer/Library/Frameworks/XCTest.framework/XCTest
    Referenced from: /var/mobile/Applications/36942309-D734-4003-8971-97C0CF047BFC/XYZ.app/XYZ
    Reason: image not found
    Dyld Version: 324.1
  
  Binary Images:
  0x120084000 - 0x1200abfff dyld arm64  &lt;628da833271c3f9bb8d44c34060f55e0&gt; /usr/lib/dyld
  0x182560000 - 0x1826bffff CoreGraphics arm64  &lt;c16c7faf626234f1992f1e7f27ef992f&gt; /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics
  0x182f68000 - 0x1831a7fff Foundation arm64  &lt;a698ba21ece734889c74bf2c20e6aea4&gt; /System/Library/Frameworks/Foundation.framework/Foundation
  0x184138000 - 0x1841b3fff MobileCoreServices arm64  &lt;21036a78054f3e3b8d018be04c3b6bf4&gt; /System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices
  0x185084000 - 0x1851fffff QuartzCore arm64  &lt;1ae8ea71790d382e84c3d403f0afaffd&gt; /System/Library/Frameworks/QuartzCore.framework/QuartzCore
  0x185264000 - 0x1852bbfff Security arm64  &lt;b27dccf33c573663b07cdbf5d3c9a797&gt; /System/Library/Frameworks/Security.framework/Security
  0x185428000 - 0x18548ffff SystemConfiguration arm64  &lt;58592ccb97af3ceb9008b388c1692d0f&gt; /System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration
  0x185494000 - 0x185ccbfff UIKit arm64  &lt;434cd368625b376d86dd6c672552efe1&gt; /System/Library/Frameworks/UIKit.framework/UIKit
  0x18ef44000 - 0x18ef57fff libz.1.dylib arm64  &lt;070746af9ba53c1ca2d1bf0d2067fb80&gt; /usr/lib/libz.1.dylib 
  </code></pre>
  
  <p>How in the world a breakpoint is getting triggered on a release build, I have no idea. I can't reproduce this while running the app from Xcode. I have removed XCTest framework from Xcode's 'Link Binary with Libraries' list. But it hasn't helped yet.</p>
  
  <p>Has anyone come across a similar issue before?</p>
  
  <p><strong>UPDATE</strong>: </p>
  
  <p>Someone has mentioned in the comments that this question may be a duplicate. I just want to point out that in the question linked, the OP has a stack trace, whereas in my case, the app is not launching at all and there is no trace in the logs.</p>