title: Xcode 11: Failed to instantiate image from asset catalog (.car file) in a custom bundle on iOS 13
body: <p>Our iOS app has a custom bundle that has an assets catalog (.car file).
  This has been the setup since iOS 9. Fetching image assets and using them has not been an issue until now with iOS 13 on Xcode 11 (not sure if it works when app is built with xcode 10 and run on iOS 13).</p>
  
  <p>This is how the bundle is used in the app:
  <a href="https://i.stack.imgur.com/LuHhi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LuHhi.png" alt="screenshot"></a></p>
  
  <p>The bundle is fetched using this code:</p>
  
  <p><code>let bundlePath = Bundle.main.path(forResource: "TheResource", ofType: "bundle")!</code><br/>
  <code>var bundle = Bundle(path: bundlePath)</code></p>
  
  <p>Now when I print this <code>bundle</code> variable I get the following:</p>
  
  <pre><code>(lldb) po bundle
  ▿ Optional&lt;NSBundle&gt;
    - some : NSBundle &lt;/Users/xyz/Library/Developer/CoreSimulator/Devices/SE8C7E9D-76AF-4564-B21B-78DC990F3D2E/data/Containers/Bundle/Application/PD422A04-B4C8-42F0-A5CB-9465AC70D3A2/abc.app/TheResource.bundle&gt; (not yet loaded)
  </code></pre>
  
  <pre><code>(lldb) po bundle.loadAndReturnError()
  Error Domain=NSCocoaErrorDomain Code=4 "The bundle “TheResource” couldn’t be loaded because its executable couldn’t be located." UserInfo={NSLocalizedFailureReason=The bundle’s executable couldn’t be located., NSLocalizedRecoverySuggestion=Try reinstalling the bundle., NSBundlePath=/Users/xyz/Library/Developer/CoreSimulator/Devices/SE8C7E9D-76AF-4564-B21B-78DC990F3D2E/data/Containers/Bundle/Application/PD422A04-B4C8-42F0-A5CB-9465AC70D3A2/abc.app/TheResource.bundle, NSLocalizedDescription=The bundle “TheResource” couldn’t be loaded because its executable couldn’t be located.}
  </code></pre>
  
  <p>This is the response I get on both a iOS 12 device and a iOS 13 device. But the assets load fine on iOS 12.</p>
  
  <p>I have tried the following things to no avail:<br/>
  1. Since there is an issue with Xcode 11 throwing the multiple paths generating the same file error, I renamed the .car assets catalog from Assets.car to something more descriptive.<br/>
  2. called .load() on the bundle variable to try and load it since it kept saying not loaded.<br/>
  3. Tried to load images with extension, also tried adding some traits and use the <code>UIImage(named: &lt;name&gt;, in: &lt;bundle&gt;, compatibleWith: &lt;traits&gt;)</code> method.</p>
  
  <p>Found this <a href="https://forums.developer.apple.com/thread/123490" rel="nofollow noreferrer">question on apple forum</a> but thats little different than the behavior I am seeing.</p>
  
  <p>Have no idea why the assets load fine when the app is built with Xcode 11 and run on iOS 12 but do not load when run on iOS 13 devices/simulators.</p>
  
  <p>Any help would be appreciated, I am dumbfounded by this issue.
  Thanks!</p>