1.2: A Strange Error
When you make new target's and change your file's locations in the Finder, you may find that Xcode hasn't followed you. You run your program and you end up with the error: "no such file or directory: 'file path'". I wanted to change the name of the first target to "Beginning" from "Begin". I ran into this error and thought others might run into the same issue. Take a look at the report from the Issue Navigator in the Navigator Panel.
We already told Xcode where the files are located (i.e. none of the file names are red in the Project Navigator).
We also already assigned a target to each file.
So what went wrong? Why is Xcode not looking in the correct file locations? Did you notice that the file path says .../Begin/Beginning/... instead of .../Beginning/... How do we fix this problem? In the Project navigator, click on the group folder, "Beginning". Now look at the File Inspector in the Utilizes Panel. Notice something wrong? The location is wrong--it says Begin, not Beginning. Click on the file icon next to Begin and select the Beginning folder in Finder. Now you're group is associated with the actual file that holds the project files for this target.
This is all because we have chosen to set the locations of each file "Relative to Group". Now we have to go back through each of the files and reassign them to their appropriate locations. Now you can run your app.
The alternative is to set the location of each individual file to "Absolute Path". Either way, now you have a working app if you were getting this error.
Don't forget to comment! Help me make these tutorials better! When you're ready, click here for the next tutorial.
Issue Navigator |
We already told Xcode where the files are located (i.e. none of the file names are red in the Project Navigator).
We also already assigned a target to each file.
So what went wrong? Why is Xcode not looking in the correct file locations? Did you notice that the file path says .../Begin/Beginning/... instead of .../Beginning/... How do we fix this problem? In the Project navigator, click on the group folder, "Beginning". Now look at the File Inspector in the Utilizes Panel. Notice something wrong? The location is wrong--it says Begin, not Beginning. Click on the file icon next to Begin and select the Beginning folder in Finder. Now you're group is associated with the actual file that holds the project files for this target.
This is all because we have chosen to set the locations of each file "Relative to Group". Now we have to go back through each of the files and reassign them to their appropriate locations. Now you can run your app.
The alternative is to set the location of each individual file to "Absolute Path". Either way, now you have a working app if you were getting this error.
Don't forget to comment! Help me make these tutorials better! When you're ready, click here for the next tutorial.
Comments
Post a Comment