问题
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.
The error is:
Error loading file: The operation couldn’t be completed. (GLKTextureLoaderErrorDomain error 12.).
Does anyone know what this error means? I haven't found any information on code 12.
Thanks in advance!
回答1:
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.
来源:https://stackoverflow.com/questions/11586702/glktextureloader-texturewithcontentsoffile-fails-for-the-first-time