baablo
baablo

Reputation: 21

Files added to xcode project show red on another Mac

Files added to xcode project show red on another Mac. Both the windows while adding files to the project look the same. When I re-add them in the newly opened project, it starts working fine. I need to know what's causing this.

Upvotes: 2

Views: 3173

Answers (5)

thamster
thamster

Reputation: 1562

xcode buggyness, you should try this next time:

rm -rf ~/Library/Developer/Xcode/DerivedData/

Upvotes: 0

jkd359
jkd359

Reputation: 161

I guess it depends on your preferred work environment but i continuously copy all my files over to avoid the dreaded red triangles.

Upvotes: 0

0x8badf00d
0x8badf00d

Reputation: 6401

When you add files to Xcode project, you would see "Copy items to destination group's folder". By default it's unchecked. So it copies references. When you move the resource that you added to Xcode to a different location on same computer or open in another computer it looks for that reference which is missing. So you see missing items as red. If you check that box "Copy items to destination group's folder" when prompted for, you wouldn't see that.

There can be another reason. If you or someone have accidentally removed file from the Project folder from finder but not Xcode, you would see same effect.

Upvotes: 3

ErikAndren
ErikAndren

Reputation: 251

I managed to get everything red by accidentally moving the project folder. After moving the directory back all files were red-marked.

I resolved this by clicking on the project root on the left pane Clicking the arrow pointing right next to the "Full path" on the right pane under Identity.

By selecting another option and back the project refreshed itself.

Upvotes: 0

IronMensan
IronMensan

Reputation: 6831

There is an option in the project selecting if files should be stored with absolute or relative paths; it may be set to absolute. If it is, other machines will only be able to find the files if they are in the exact same location and not just in the same location relative to the project file.

You can test this by adding a file and saving the project then checking it in a text editor. Right click on the project in Finder and click "Show package contents." You can then open project.pbxproj (or something like that) in any text editor. You can even use Xcode. Find the file you just added and see how it is storing the path.

Upvotes: 1

Related Questions