Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add file to project in Xcode 9?

I created a new project in xcode 9.

I want to add image file to project.

enter image description here

enter image description here

When I delete this file from desktop,

Image file appears in red?

enter image description here

But in project folder, I find this image file.

enter image description here

In Xcode 8 its working fine,

Any idea?

like image 542
aiur Avatar asked Jul 14 '17 06:07

aiur


1 Answers

It is an Xcode9-beta (9M136h) bug. I don't know if it has been resolved in beta3 or not. Copy items if needed copies the file to your project directory but still links to the original file.

What I do is, after dragging the file to my project, I select the folder icon (see red circle in the image below) from File Inspector and point to the copied file in the project directory.

image of the file inspector showing folder icon

@pesch's approach works too. First copy the image to your project folder and then drag it to Xcode.

like image 183
enigma Avatar answered Sep 20 '22 06:09

enigma