skip to Main Content

The question has been asked several times for previous (old) versions of XCode, but answers don’t seem to apply to XCode 16.

How to embed, in the Resources folder of an App Bundle, resources with structured folders ?

Whatever I do (e.g. Group or Folder (blue or grey) file structured in the Navigator), I still get a flat list of all resources, which of course can’t work if you have several resources with the same name (but in different folders).

Example, this will not build with XCode 16 because of the 2 resources "Marguerite.jpeg":
enter image description here

I even tried with an additional run script

cp -r $SRCROOT/MyResources $BUILT_PRODUCTS_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH

but the Sandbox prevents that too.

2

Answers


  1. Chosen as BEST ANSWER

    Here is how I worked around the problem. Clearly not ideal, but working : I used scnassets to build the folder structure.

    scnassets can be nested and are included in the Bundle as a tree of directories. The directory names are suffixed with the extension '.scnassets', but I can live with that.

    enter image description here

    If anybody has a better answer, I'll be glad to accept it.


  2. The method is very obscure in XCode 16:

    1. Go to Copy Bundle Resources Phase
    2. Click the + Button
    3. Click Add Other
    4. Select the top directory of the structure you want to add
    5. In the "Choose options for adding these files" dialog, tick Create folder references
    6. Click Finish
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search