Search code examples
xcodebundlexcode9

Xcode 9 no longer copies xcassets into bundle target


I updated to Xcode 9 and now when I build my bundle target, it no longer contains the xcasset images resources.

Setup:

  1. The xcasset is associated with the target Xcode 9 showing association with target

  2. The xcasset is included in the "Copy Bundle Resources" of the bundle target's Build Phases.

Xcode 9 showing copy bundle resources

Result

The images within the xcassets are not present with the bundle product. Terminal showing result of build

On a different machine with Xcode 8 I can build the same bundle target and the images within the TestCatalog are present.

Note: the TestImage.png (that exists outside of any xcassets) is included as expected on Xcode 9. This leads me to think that the issue is related to how xcassets are included.

Thanks for any help.


Solution

  • It's working just fine! Assets.car is actually your asset catalog, and your images are inside it.

    If Xcode was previously pulling the images out of the asset catalog and putting them at the top level of the framework, that was wrong behavior! Asset catalog images are supposed to be compiled into the compiled version of the asset catalog (the .car file). And that is now exactly what is happening. And there is no reason why the asset catalog should not be renamed in the course of compilation (since there is no way you can refer directly to an asset catalog by name in code anyway).

    You could confirm that that's what happened by reading the Report generated during compilation. You don't include that in your screen shot, however. I'll show you. Here's my project, similar to yours:

    enter image description here

    And here's the relevant part of the report:

    enter image description here

    As you can see the last couple of lines, MyFrameworkAssets.xcassets has been compiled to the asset catalog called /MyCoolFramework.framework/Assets.car, exactly as in your project.

    So I think the problem is merely that you are trying to look at this "from the outside" (i.e. using Terminal). The way really to know whether this is working is for your framework code to refer to an image and display it, and it seems you have no such code. You can also download AssetCatalogTinkerer and look inside the assets.car file. You will see that your image is in there!