本文介绍了GLKTextureLoader textureWithContentsOfFile:第一次失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 GLKTextureLoader
将图像纹理加载到精灵中.
I am using GLKTextureLoader
to load image textures into a sprite.
当我运行以下代码并加载两个精灵时...
When I run the following code and load two sprites...
NSString *pathToImage = [NSString stringWithFormat:@"%@/defaultProject/images/%@", [Util applicationDocumentsDirectory], fileName];
NSLog(@"path: %@", pathToImage);
self.textureInfo = [GLKTextureLoader textureWithContentsOfFile:pathToImage options:options error:&error];
if (self.textureInfo == nil)
{
NSLog(@"Error loading file: %@", [error localizedDescription]);
return;
}
...第一个图像失败,但第二个图像失败.
... it fails for the first image but not for the second.
错误是:
Error loading file: The operation couldn’t be completed. (GLKTextureLoaderErrorDomain error 12.).
有人知道这个错误是什么意思吗?我没有找到任何关于代码 12 的信息.
Does anyone know what this error means? I haven't found any information on code 12.
提前致谢!
推荐答案
Error code 12 表示 GLKTextureLoaderErrorDataPreprocessingFailure
as per (Apple 文档)
Error code 12 means GLKTextureLoaderErrorDataPreprocessingFailure
as per (Apple Docs)
我认为错误的原因是文件损坏.尝试重新保存损坏的图像.
I think cause of error is a file corruption. Try to re-save your corrupted image.
这篇关于GLKTextureLoader textureWithContentsOfFile:第一次失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!