iPhone Simulator Icon Black

2019-08-03 16:03发布

问题:

I have two Icon files in my plist: icon.png icon@2x.png

Both are added to my project, added to the target and are 57x57 and 114x114 pixels respectively, both 72 dpi.

They are both pngs generated from a .svg.

I filled out the transparency with white. The rest of the coloring is black.

I have tried deleting the app, clearing derived data and re-running.

Why is this icon showing a black square in the iPhone 6 simulator?

EDIT: Tried renaming to capital I in Icon.png and Icon@2x.png. Wiped app, wiped derived data, clean, still no dice.

回答1:

Try the following:

1 - On the simulator remove your app just like you delete an app on an iPhone.

2 - On xcode go to the menu Product and click Clean. (Or the shortcut Shift+Command+K)

3 - Try to run again.

edit: When you open the png's on your computer do they actually show the white?



回答2:

So I was having the same problem and found this old thread. In my case the issue turned out to be the alpha channel in the PNG icon. Specifically: my icon was black-on-transparent, so on the simulator with a black background it showed as black-on-black. I solved by opening in Preview and exporting with the "alpha" button turned off.