Adding resource files to xcode

2019-01-17 09:22发布

I'm trying to add some new resource files to a project which was build by another person on another mac. I think that the project has the provision of the previews person.

Using right click->Add Files to "MyProject" doesn't provide the expected result. After I compile the project, the added file is not visible in the application.

How can I add new resources in my project?

PS: I'm trying to learn Objective-C in a macincloud.com account.

3条回答
Animai°情兽
2楼-- · 2019-01-17 10:01

It might be that the file you added was not added to the project build. Click your project > App target > Build Phases And check that the file exists in Compile sources (if it needs to be compiled), otherwise check Copy bundle resources. If the file does not exist there, drag it there and it should be fine, (from what I understand of your question).

EDIT

You can also check wether a file is added to the target by clicking the file and opening the "File Inspector" (View > Utilities > Show File Inspector, or + + 1), and check the Target Membership section.

Example:
Example

查看更多
何必那么认真
3楼-- · 2019-01-17 10:07

Just drag the resource file (from a finder window) into your project files area (left side) and drop in supporting files.

Once you drop, a dialog will prompt you which targets to add it for. Select all that are appropriate. Thats it.

查看更多
闹够了就滚
4楼-- · 2019-01-17 10:20

Adding to Copy bundle resources worked for me

enter image description here

查看更多
登录 后发表回答