App icon displays a black square. - ios

I am having my app icon be displayed as a black square instead of the intended image.
I have placed all of my AppIcons into the folder, Im wondering what could be causing this.

Your image needs to be an opaque PNG. No transparency or anything, as well as being the correct size.
If it already is that, try opening it in Preview and re-saving it as a PNG. That way OS X 'generated' it and it should be compatible. If that helps fix the issue, then your image editing program is saving in the wrong format...see info below.
Apple has this to say on generating PNGs:
For all images and icons, the PNG format is recommended. You should avoid using interlaced PNGs.
The standard bit depth for icons and images is 24 bits—that is, 8 bits each for red, green, and blue—plus an 8-bit alpha channel.

I have had this happen when the app is listed as a .png file, but the system is recognizing it as a .jpg or some other type ... find your icon in "finder" and open it with preview, go to the file menu select "export as" and make sure you choose PNG as the save format. Delete the old version in the application, delete the derived data, clean your project, and rebuild the application.

Related

Xcode 8.3.3 won't accept AppIcon

When i try to drop PNG images for AppIcon in Assets.xcassets,
Placeholder: iPhoneApp iOS 7-10 60pt
Xcode does not accept these images. Images are PNG of right size 120x120(60x60#2x) and 180x180(60x60#3x), respectively.
If you have any suggestion please help.
According to the documentation, three parameters are important for the App Icon:
Format: all icon images must be in PNG format. Icon images may include an alpha channel but should not include any transparent regions.
The size: Here the base size is 60*60, so 120*120#2x and 180*180#3x.
Color model: It should be RGB.
You can check all these values with the Preview Inspector. In your case, the background of your icon is not visible in your screenshot (white or transparent?) so I would check for the transparency.
Also, I would double check the size. Some image editors tend to round the values and add 1px on one of the dimensions.
I resolved this.
Problem was that my files, although PNG images, did not have .png extension in file name. XCode did not recognize image format without extension, and did not show any warning.
After adding extension, everything start working properly.

Xcode + PDF images colors look darker in simulator/device (color space issue)

I know this isn't a new problem and I've done a full day (literally) of research. I use the latest Xcode 6, and I'm trying to use all PDF files as vector art resources. However, when I export these images from Illustrator in sRGB (sRGB IEC61966-2.1) , these images show up noticeably darker than if I used a png file.
Some previous suggested solutions are: setting Illustrator file color profile to "web" and choose color space "RGB", and exporting to pdf with Illustrator converting the color space to "sRGB IEC61996-2.1". The latter worked for me for one of the images... And today when I tried the same thing it didn't work!
So I tried all the other solutions, I retried, restarted, tried using different programs, renaming resources, cleaning the project... Nothing worked! The colors still look darker on screen, and the old PDF icon I made look perfect still!
The PDF looks perfect in any other viewer, including Xcode itself, by the way. It's when Xcode compiles, the images get broken (PNG files are generated, and something is wrong with their colorspace).
This is driving me nuts... Anyone else having this problem?
Depending on the screen, you can tell that the center button is quite a bit lighter than the other two icons. I intersected two just to show how distinguishable it is. But on my MacBook Air, they appear identical. Perhaps this has to do with what people say about Apple taking the compiling machine's color space into account? On my iPhone and MacBook they look very different.
Update If I change my MacBook Air's display -> color profile to sRGB, I can clearly tell the difference now. I'm retrying importing the PDF,and maybe the conversion will be correct. Will update.
I've had tremendous troubles with this. And I finally figured it out.
Apple uses sRGB for iOS. To do this you must save your pdf (convert to) in sRGB. I do this with Illustrator -> new -> profile = "web", color space = "RGB" -> save as PDF -> (in options) convert to sRGB. This is suggested by many others in similar questions' solutions. The next... Is what I found out. A trap, if you will.
CAUTION! When you copy past paths over to the new artboard in RGB, the RGB values may have been changed by Illustrator. This took me ages to figure out... Even though the saving to PDF part was right, Illustrator broke it by changing the values by default, making everything darker and more dull.
Hope this helps!

vector images in xassets have different colors

I'm pulling pdf files into Xcode via images.xassets -> image set -> type: vectors. The PDF looks great, but when I look at the images on the device, the colors are changing slightly. Exporting the PDF as individual PNG files and doing it the old way is working fine.
Has anyone else run into this? The color change is bad enough to revert back to the old way for any non monochromatic image. When exporting to PDF with Illustrator, verified that we're using RGB mode and not anything else
check out the deployment target, it should be 7.0 or above. Because of Vector pdf only supports 7.0 and above.
Check Alpha value. I had this issue in the past and the alpha value caused this problem. If i had saved my images with this colours would have been changed a little.
There is a setting on illustrator when exporting to PDF that was causing my problem. Follow: Xcode generates png form pdf with different colors

Images can't contain alpha channels or transparencies

Apple has released new version of iTunes Connect & I got an error message when I tried to set Screenshots on itunes connect for my app.
"Images can't contain alpha channels or transparencies."
I've found you can also just re-export the png's in Preview, but uncheck the Alpha checkbox when saving.
AFAIK png with transparency is not allowed. use jpg OR update your png (photoshop or whatever you using to create the png) and delete the transparency areas. if you work with shadows, use jpg, that will do no headaches.
it's so easy...
Open image in Preview app click File -> Export and
uncheck alpha
For this i made a new simple tool. You can remove alpha channel (transparency) of multiple .png files within seconds.
You can download from here http://alphachannelremover.blogspot.com
Use mogrify tool from ImageMagick package to remove alpha channel.
brew install imagemagick
cd folder_with_images
mogrify -alpha off */*.png
Update from May 3
You can tell whether image contains alpha channel by running:
sips -g all image.png
In case you render screenshots in iOS Simulator you can drop alpha channel by passing BOOL opaque = YES to UIGraphicsBeginImageContextWithOptions:
UIGraphicsBeginImageContextWithOptions(imageSize, YES, 0);
You must remove alpha channels when uploading a photo to iTunes Connect.
You can do this by Preview, Photos App (old iPhoto), Pixelmator, Adobe Photoshop and GIMP.
Preview
Open the photo in Preview (if the photo is in your photo album in Photos app (the old iPhoto), then simply drag it from the album to desktop. Then control-click (right-click when mouse) the duplicated photo and select Preview.app under Open With menu).
Select Export… under File menu, and after selecting the destination, uncheck Alpha at the bottom, and click Export.
Pixelmator
Open the image in Pixelmator, without creating a new Pixelmator file. Just drag the photo to the Pixelmator window.
From Share menu, click Export for Web…
In the top bar, deselect Transparency.
Click Next and then save the new file somewhere.
Finally, upload the new photo to iTunes Connect.
GIMP
Open the photo in GIMP.
Open the Layer menu.
Under Transparency, click Remove Alpha Channel.
Save the photo.
Adobe Photoshop
Open the photo in Adobe Photoshop.
Under Layer menu, click Layer Mask and then From Transparency.
Delete the layer mask by right-clicking on the mask in the Layer panel and selecting Delete Layer Mask.
If you are using Photoshop go File > Save for web (Command + Option + Shift + S). Make sure the Transparency is unchecked and this should work.
Still a problem in 2019 :=)
This worked for me:
Select all images you want to upload -> Right click -> Open in Preview -> Export -> Uncheck alpha -> Use the exported images.
Extending Roman B. answer. This is still a problem, I was uploading a cordova app. my solution using mogrify:
brew install imagemagick
* navigate to `platforms/ios/<your_app_name>/Images.xcassets/AppIcon.appiconset`*
mogrify -alpha off *.png
Then archived and validated successfully. 👍
On Pixelmator you can use 'Share > Export for Web...' (⇧ + ⌘ + E)
and deselect Transparency in the Tool Options Bar.
i have same problem just compress your png file on https://tinypng.com/ online and then try to upload that new compressed png file.
its work for me.
You can remove the alpha channel from a PNG file from the command line with pngcrush, using the flag "-c 2":
$ file input.png
input.png: PNG image data, 1024 x 1024, 8-bit/color RGBA, non-interlaced
$ pngcrush -q -c 2 input.png output.png
libpng warning: iCCP: known incorrect sRGB profile
$ file output.png
output.png: PNG image data, 1024 x 1024, 8-bit/color RGB, non-interlaced
Note the change from RGBA to RGB: the Alpha channel is gone!
pngcrush lives at http://pmt.sourceforge.net/pngcrush/
Faced same issue, Try using JPG format !! What worked for me here was using a jpg file instead of PNG as jpg files don't use alpha or transparency features. I did it via online image converter or you can also open the image in preview and then File->Export and uncheck alpha as option to save the image and use this image.
To get around the problem I batched converted using fireworks my png32 files to png24 for upload quick and easy. Jpeg works also but it is lossy.
Faced same issue, Try using JPG format !!
Photoshop
Slice it
Save for web
Uncheck Transparency
You can export to PNG without alpha in Preview. Simply open your image, choose export, select PNG, uncheck Alpha, and click Save. Preview also support batch export if you open all your images at once.
On Windows 10 you can use Paint 3D.
Open the image
Choose "Canvas" in the top menu
De-select the "Transparent canvas" checkbox in the right panel
Save
If you have imagemagick installed, then you can put the following alias into your .bash_profile. It will convert every png in a directory to a jpg, which automatically removes the alpha. You can use the resulting jpg files as your screen shots.
alias pngToJpg='for i in *.png; do convert $i ${i/.png/}.jpg; done'
What worked for me here was using a jpg file instead of PNG as jpg files don't use alpha or transparency features. I did it via online image converter or you can also open the image in preview and then File->Export and uncheck alpha as option to save the image and use this image.
You can simply create a new Photoshop document and set its default background to White instead of Transparent. Then, copy and paste your image to the newly created document and save it.
Exporting from Sketch
To avoid transparency, ensure no layer extends beyond the artboard bounds.
Convert your PNG image to JPEG format.

Use JPEGs for Launch Images

This is related to Default-Portrait.png for iPad: any way to make the file size smaller?
Is there any way to specify a more efficient file format (like JPEG) for Default-Landscape.png
and Default-Portrait.png?
Yes it's possible to use jpg files as launch images. Just add "Launch image" key with the base filename (e.g. LaunchImage.jpg") to the Info.plist. Then add files to your project such as
LaunchImage.jpg
LaunchImage#2x.jpg
LaunchImage-568h#2x.jpg
and Xcode will pick them up.
However through personal experience I've discovered if you're supporting the larger iPhone 5 screen the App Store expects PNG format and uses the presence of PNG to determine iPhone 5 support and display of iPhone 5 size thumbnails on the store. Using JPG images will not show the app as iPhone 5 optimized in the app store (even though it will work fine on the device) so it is best to stick with PNG.
There is no way to use an image other than a png.
All launch images must be PNG files and must reside in the top level of your app’s bundle directory. Section: App Launch (Default) Images
Update: JPEG images to work and Apple's documentation no longer specifies that the images must be PNG files.
If you use xcassets, then since Xcode 6 you can use JPGs. However Xcode will still not let you drop JPGs into the LaunchImage folder. But you can do it in Finder. Simply drop your PNGs into that folder with Finder and then edit the JSON file changing all .png extensions to .jpg.
I haven't submitted an app to the store using this yet, but it works in the iPhone simulator at least.
Update: Doesn’t work on the device. I’ll leave this answer here anyway so people know that this technique was at least tried so the effort won’t be repeated.

Resources