Reputation: 3134
I'm getting these errors:
I can't tell exactly which thing it is talking about?
If it is a 42 mm 2x, then I don't have a spot to put that. Can you help? Thanks!
EDIT: Per comment below, I looked on the right pane. Looks like it needs the 44 2x...
...so I have one created, but the Unassigned
doesn't highlight when I drag the icon over it, so how do I assign it in my image assets?
EDIT again:
Right click show in finder?
Upvotes: 34
Views: 26068
Reputation: 2285
In my case I accidentally removed some assets and then returned them by means of git (just reverted deleted files from Xcode's Source Control tool) – the image files came back, but the asset didn't work and I had the same warning.
I opened the Contents.json file in the asset directory and saw that the images
array was empty. I added my images there manually. For example:
{
"images" : [
{
"idiom" : "universal",
"filename" : "Icon.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Upvotes: 0
Reputation: 4418
My case is:
My Macbook is running out of memory, so every time I restart the computer. I don't understand how the icloud driver erased or replaced all the data in the Contents.json
file in the folder:
Runner> Assets.xcassets> AppIcon.appiconset
(I dev with Flutter).
So the solution for my case is I have to bring the Contents.json file back from the back up and it works normally.
Upvotes: 0
Reputation: 1273
I had old icon files (no longer needed) in the folder where contents.json is located. I removed those files in Finder and the issue was solved.
Upvotes: 1
Reputation: 13242
I had to
Though, I don't know why those menu options are disabled in the original question...
Upvotes: 2
Reputation: 744
I had the same issue! The solution that worked for me was pretty easy:
Just select the unassigned image and delete it via delete button. Clean and Build. Done.
Hope this helps!
Upvotes: 69
Reputation: 9940
Remove all "unassigned" photos from the asset catalog. It shouldn't appear there (click "Remove Selected Items" on your screenshot).
Upvotes: 1
Reputation: 9564
(That's assuming you didn't miss any of the required images)
I had this problem a while ago: I went into the media.xcassets
directory and checked the contents.json
file, where I found some entry with "unassigned"
set to TRUE. I removed it and it removed the compiler warning.
Hope you got stuck in that same scenario so you will also be able to fix it.
Upvotes: 4