繁体   English   中英

GLKTextureLoader textureWithContentsOfFile:第一次失败

[英]GLKTextureLoader textureWithContentsOfFile: fails for the first time

我正在使用GLKTextureLoader将图像纹理加载到精灵中。

当我运行下面的代码,并装载两个精灵...

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;
}

...对于第一个图像失败,但对于第二个图像则失败。

错误是:

Error loading file: The operation couldn’t be completed. (GLKTextureLoaderErrorDomain error 12.).

有人知道这个错误是什么意思吗? 我没有找到有关代码12的任何信息。

提前致谢!

错误代码12表示根据( Apple DocsGLKTextureLoaderErrorDataPreprocessingFailure

我认为错误原因是文件损坏。 尝试重新保存损坏的图像。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM