-
Creator 版本: 3.8.7
-
目标平台:iOS 苹果8Plus
在构建到iOS端在苹果手机上运行部分图片不可见
浏览器正常设置弹窗:日志:14:20:24 [DEBUG]: JS: 设置按钮被点击
14:20:24 [DEBUG]: JS: [UIManager] [LOG] [Thu Apr 16 2026 14:20:24 GMT+0800 (CST)] show: PopSetting
V/AudioCache (193): id=2 _pcmData alloc: 0x11dd64000
V/AudioCache (226): pcm buffer was loaded successfully, total frames: 12672, total read frames: 12672, adjust frames: 0, remainingFrames: 0
V/AudioCache (235): id=2 generated alGenBuffers: 2429 for _pcmData: 0x11dd64000
V/AudioCache (236): id=2 _pcmData alBufferData: 0x11dd64000
14:20:24 [DEBUG]: JS: [UIManager] [LOG] [Thu Apr 16 2026 14:20:24 GMT+0800 (CST)] 加载: PopSetting
14:20:24 [DEBUG]: JS: [PopSetting] [LOG] [Thu Apr 16 2026 14:20:24 GMT+0800 (CST)] beforeShow
14:20:24 [DEBUG]: JS: [PopSetting] [LOG] [Thu Apr 16 2026 14:20:24 GMT+0800 (CST)] onShow
14:20:24 [DEBUG]: JS: copyTexImagesToTexture: Convert texImages to data buffers failed
14:20:24 [DEBUG]: JS: copyTexImagesToTexture: Convert texImages to data buffers failed
14:20:24 [DEBUG]: JS: copyTexImagesToTexture: Convert texImages to data buffers failed
14:20:24 [DEBUG]: JS: copyTexImagesToTexture: Convert texImages to data buffers failed
14:20:24 [DEBUG]: JS: copyTexImagesToTexture: Convert texImages to data buffers failed
14:20:24 [DEBUG]: JS: copyTexImagesToTexture: Convert texImages to data buffers failed
14:20:24 [DEBUG]: JS: copyTexImagesToTexture: Convert texImages to data buffers failed
14:20:24 [DEBUG]: JS: copyTexImagesToTexture: Convert texImages to data buffers failed
14:20:24 [DEBUG]: JS: copyTexImagesToTexture: Convert texImages to data buffers failed
14:20:24 [DEBUG]: JS: copyTexImagesToTexture: Convert texImages to data buffers failed
14:20:24 [DEBUG]: JS: copyTexImagesToTexture: Convert texImages to data buffers failed
14:20:24 [DEBUG]: JS: copyTexImagesToTexture: Convert texImages to data buffers failed
14:20:24 [DEBUG]: JS: copyTexImagesToTexture: Convert texImages to data buffers failed
14:20:24 [DEBUG]: JS: copyTexImagesToTexture: Convert texImages to data buffers failed
14:20:24 [DEBUG]: JS: copyTexImagesToTexture: Convert texImages to data buffers failed
14:20:24 [DEBUG]: JS: copyTexImagesToTexture: Convert texImages to data buffers failed
14:20:24 [DEBUG]: JS: copyTexImagesToTexture: Convert texImages to data buffers failed
14:20:24 [DEBUG]: JS: copyTexImagesToTexture: Convert texImages to data buffers failed
14:20:24 [DEBUG]: JS: copyTexImagesToTexture: Convert texImages to data buffers failed
14:20:24 [DEBUG]: JS: copyTexImagesToTexture: Convert texImages to data buffers failed
14:20:24 [DEBUG]: JS: copyTexImagesToTexture: Convert texImages to data buffers failed
14:20:24 [DEBUG]: JS: copyTexImagesToTexture: Convert texImages to data buffers failed
14:20:24 [DEBUG]: JS: copyTexImagesToTexture: Convert texImages to data buffers failed
14:20:24 [DEBUG]: JS: copyTexImagesToTexture: Convert texImages to data buffers failed
14:20:24 [DEBUG]: JS: copyTexImagesToTexture: Convert texImages to data buffers failed
后面发现是 Cocos 引擎在 iOS 原生上的一个适配问题—— copyTexImagesToTexture 函数无法识别纹理数据类型,导致所有图片上传 GPU 失败。 copyTexImagesToTexture 函数只处理了两种类型:
-
HTMLCanvasElement→ 取texImage._data.data -
HTMLImageElement→ 取texImage._data
但 iOS 原生下, ImageAsset.data 返回的是 第三种格式 ( _nativeData 对象,不是 HTMLImageElement 也不是 HTMLCanvasElement),所以直接走到了 else 分支报错返回 → 所有图片上传 GPU 失败 → 按钮图片全空 。
代码: else if (texImage._data) {
images.push(texImage._data);
} else if (texImage.data && texImage.data._data) {
In some cases, the ImageAsset object is passed, and the data attribute is the _nativeData
images.push(texImage.data._data);
}
我目前是直接修改的是构建之后的这个文件:build/ios/data/jsb-adapter/engine-adapter.js。
估计还要修改引擎里面的对应的这个JS文件:/Applications/Cocos/Creator/3.8.7/CocosCreator.app/Contents/Resources/resources/3d/engine/bin/adapter/native/engine-adapter.js
官方后续是否可以修复这个问题呢?



