Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't I add files to Images.xcassets in Xcode 5?

When trying to add image files to Images.xcassets, there are certain images that I cannot add. I've tried both dragging-and-dropping as well as using "+" followed by "Import". In the drag-and-drop case, nothing happens. In the Import case, the files I'd like to import are grayed out and cannot be selected.

I'm using Xcode 5.0.2 and I'm trying to import a JPG that's 60x105 pixels, with no transparency or layers.

However, some image files I can import. It's just that the ones I want I cannot for some reason. Are there limitations to the types of images you can import? I've done some googling, searching on forums, and in online developer help for more information about that but haven't found any explanation of any specific limitations on what you can import. Suppose then that no limitations exist, then is there another possible reason why can't I import some of these files?

As an added mystery, the images I'm trying to add are images I've downloaded to do the homework for Stanford's CS 193p course on iPhone programming available on iTunes. I watched the professor of the course drag-and-drop these very files into his Images.xcassets with no problem. So why can't I do that? It seems like I must be missing something obvious!

I'm very stuck on this and I would appreciate any suggestions!

Thanks, Mark Xcode 5, OS X Mavericks (10.9.1)

like image 858
user3230300 Avatar asked Jan 24 '14 02:01

user3230300


2 Answers

I've only ever had luck using PNG images inside the asset catalog. You can use the Preview to open your JPEG image and Export it to PNG.

like image 115
andrewcbancroft Avatar answered Oct 26 '22 19:10

andrewcbancroft


I had a similar issue when trying to add a PNG file as well. I tried Importing as well as drag & dropping, and it simply wouldn't work (wouldn't give me an error, either). For some reason, I had to ensure that the filename ended in lowercase ".png" as opposed to ".PNG".

Not sure why it happened, but simply renaming the extension to lowercase ".png" seemed to fix the problem.

like image 36
user3587293 Avatar answered Oct 26 '22 18:10

user3587293