Google iOS 的 Maps SDK:不支持小端位图

Google Maps SDK for iOS: don't support little endian bitmaps

我正在尝试在 Google 地图中为 iOS SDK 实现一个 GMSTileLayer 子类。我在磁盘上有一堆 PNG 图像,用于图块层中的每个图块,它们是使用 UIImage(contentsOfFile:) 加载的。当我尝试加载图像时,它们没有显示,我在日志中收到此消息:

2015-08-22 22:50:10.663 inPin[44718:24904635] ((null)) was false: Don't support little endian bitmaps
2015-08-22 22:50:10.663 inPin[44718:24904635] ((null)) was false: Unable to create GMSGLImageTile due to bad graphics data

我不知道 PNG 图像甚至有字节序,所以我不知道这条消息是从哪里来的。任何人都知道为什么会这样?我尝试了来自 Google tile 服务器的 PNG,它工作正常。我的 PNG 是由使用 ImageMagick 的脚本生成的。

好的,我明白了。原来我的图像有 16 位色深,将其更改为 8 位会使错误消失。在 ImageMagick 中,我只需要添加 -depth 8.