Xcode Copy Bundle Resources can't find files
Asked Answered
G

2

3

Xcode can't find my Storyboards and my Info.plist in my Copy Bundle Resources, So my App doesn't run. I tried to add the Existing files again but they always appear red highlighted. I'm pretty sure it must be a local problem because when i clone the latest update from my repository on my other mac its runs without any problems. I already tried to re-install Xcode, delete files from Xcode/DerivedData and i also deleted the com.apple.Xcode.plist. Anyone any ideas?

Gameto answered 15/4, 2013 at 8:9 Comment(1)
check info.plist is avail in your project or not and if is not there just add it , check the version of Xcode for both of u r mac systemsGrinnell
A
4

Try to reset your Simulator and then clean your App Build Folder

Assemblyman answered 15/4, 2013 at 8:23 Comment(1)
That actually worked....i tried it severals times before but somehow it worked now -,-Gameto
W
0

My experience is that the proposed solution works, but cleaning and re-compiling the entire app whenever a resource has changed is very tedious, especially for larger projects.

Therefore I came up with this solution that forces fresh resources in the app on a per-directory basis, without having to clean or recompile:

  1. Add a 'Run Script Build Phase' (Editor > Add Build Phase > Add Run Script Build Phase)
    1. Copy/paste the following script into the build phase (don't forget to set the actual paths on line 1):

dirsToCopy=("path1/directory1","path2/directory2")

for INPATTERN in "${dirsToCopy[@]}"; do
    INDIR=$PROJECT_DIR/$INPATTERN/*
    OUTDIR=$TARGET_BUILD_DIR/$CONTENTS_FOLDER_PATH/$INPATTERN
    cp -R $INDIR $OUTDIR
done

For those not used to working with shell scripts:

  • paths on line 1 of the script are relative to the project directory (where the .xcodeproj file resides)

  • you can add more (or less) paths to the array dirsToCopy if you want

  • you can change the pattern of files to copy where variable INDIR is defined

  • you can change how the copying is done (currently, recursive due to -R) by changing the flags to cp in the last line of script within the for block.

Workbag answered 16/9, 2013 at 13:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.