Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
455 views
in Technique[技术] by (71.8m points)

ios - 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...