Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 4 adding images to a project

Coming from a background of Visual Studio I had no idea how good that IDE truly was until I had to work with Xcode. One of the more pressing oddities that it has just thrown up is the following.

I'm upgrading a project to a retina display and so have to add a bunch of new @X2 files. This is fine, I have the files and I go into Xcode, choose the project group where I want to add them, select them all and click 'Add'.

"Multiple errors occured" Xcode helpfully blurts and then returns to whatever it was doing before. No break down of what those errors might be, or what actually happened or why.

So I do some looking and some of the files are actually in the directory but Xcode ignores them, I can't figure out a way of adding them (it says they're already there!) but they won't appear in the xcode project.

Can I 'refresh' xcode so it looks in the directory and shows them?

==============================

PS. While I'm here and can rant a little, anyone with a VS background now using Xcode, am I wrong in thinking the following points are hugely annoying:

1) The debugger - frustratingly slow.

2) The file explorer - can't easily sort by name

3) The file explorer - column on the right listing the file names doesn't change the file highlight when you move from file to file within the editor window.

4) Adding files to a project - see above!

Some of these probably stem from lack of experience with the IDE but still, they irk.

like image 1000
Full Time Skeleton Avatar asked Oct 12 '11 11:10

Full Time Skeleton


People also ask

How do I import an image into Swift?

So, open Info. plist, select any item, click +, then choose the key name “Privacy - Photo Library Additions Usage Description”. Give it the value “We need to import photos” then press return.

How do I add an asset in Xcode?

In the Project navigator, select an asset catalog: a file with a . xcassets file extension. Drag an image from the Finder to the outline view. A new image set appears in the outline view, and the image asset appears in a well in the detail area.


1 Answers

Files in the XCode directories don't necessarily have to be in the project.

For some reason, XCode doesn't like overwriting files, and that's the warning message that I usually get when this happens too - "Multiple errors occured."

What I suggest you do is remove all of the @2x files from your project directory, and add them back into XCode using "Add Files..." Make sure you select "Copy files into project directory if necessary" though, otherwise they will just be referenced to their current location on disk.

like image 94
Chris Grant Avatar answered Sep 18 '22 10:09

Chris Grant