Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add images in project in new Xcode 9

Tags:

ios

swift

In new Xcode 9 I want to add images in project. But If I add images and try to use it in code or in storyboard my images not showing in simulator. But in Xcode 8 all works fine. How to fix it?

like image 287
user Avatar asked Nov 20 '25 09:11

user


2 Answers

Note : This Problem does not Exist Anymore in newer XCode

If you have dragged image in your project, you must select Copy If Needed While adding any file into your project.

enter image description here

After Adding Image take a look at your image if it is available to target, I have face similar issue with other file types too. In xcode9 it was not selected by default even after selecting copy if needed.

enter image description here

like image 188
Devang Tandel Avatar answered Nov 22 '25 22:11

Devang Tandel


Yes - this is super annoying. With XCode 9, now in addition to dragging a new image into the XCode Project Navigator (the left-hand list of files), you now have to go into Targets for your project, go to "Build Phases" and manually add the image file to "Copy Bundle Resources" using the "+" button at the bottom of the list of files.

This is required for any object you used to have to just drag into the project, including third-party frameworks and bundles.

PS: in dragging the image into your project you don't have to have "Copy Item if needed" selected if the image file is already somewhere in your project folder or a subfolder thereof.

like image 40
Peter Avatar answered Nov 22 '25 22:11

Peter