精灵图像无法加载

时间:2015-11-25 21:42:06

标签: ios objective-c xcode sprite-kit ios9.1

我正在开发一款精灵套装游戏。事情一直很好,直到无处不在,Xcode决定停止加载特定的精灵图像并在控制台日志中返回:

Error loading /System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib:  dlopen(/System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib, 262): no suitable image found.  Did find:
/System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib: mach-o, but not built for iOS simulator
2015-11-25 15:26:07.435 Project3[5843:800423] Cannot find function pointer IOHIDLibFactory for factory 13AA9C44-6F1B-11D4-907C-0005028F18D5 in CFBundle/CFPlugIn 0x7fba686b5a50 </System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin> (bundle, not loaded)
2015-11-25 15:26:07.435 Project3[5843:800423] Error loading /System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib:  dlopen(/System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib, 262): no suitable image found.  Did find:
/System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib: mach-o, but not built for iOS simulator
2015-11-25 15:26:07.436 Project3[5843:800423] Cannot find function pointer IOHIDLibFactory for factory 13AA9C44-6F1B-11D4-907C-0005028F18D5 in CFBundle/CFPlugIn 0x7fba686b5a50 </System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin> (bundle, not loaded)
2015-11-25 15:26:07.436 Project3[5843:800423] Error loading /System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib:  dlopen(/System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib, 262): no suitable image found.  Did find:
/System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin/Contents/MacOS/IOHIDLib: mach-o, but not built for iOS simulator
2015-11-25 15:26:07.436 Project3[5843:800423] Cannot find function pointer IOHIDLibFactory for factory 13AA9C44-6F1B-11D4-907C-0005028F18D5 in CFBundle/CFPlugIn 0x7fba686b5a50 </System/Library/Extensions/IOHIDFamily.kext/Contents/PlugIns/IOHIDLib.plugin> (bundle, not loaded)

我用来添加图片的代码是:

self.superball = [SKSpriteNode spriteNodeWithImageNamed:@"sbstore2.png"];
    self.superball.position = CGPointMake(CGRectGetMidX(self.frame)-200,CGRectGetMidY(self.frame));
    [self addChild:self.superball];

我该怎么做才能解决此错误?我正在使用Xcode 7.1.1,这是在我升级到此之后首先注意到的。

1 个答案:

答案 0 :(得分:0)

我不认为这是一个错误。正如KnightOfDragon所说,你不应该使用ImageNamed来扩展,我还建议使用Clean

self.superBall = [SKSpriteNode spriteNodeWithImageNamed:@"sbstore2"];

您可以只设置节点的纹理,而不是使用上面的初始化程序。

self.superBall.texture = [SKTexture textureWithImageNamed:@"sbstore2"];

甚至runnig动作来改变纹理。

[self.superBall runAction:[SKAction setTexture:[SKTexture textureWithImageNamed:@"sbstore2"]]];

如果这些都不起作用,则应仔细检查您的图像名称是否正确。 如果您只是通过拖动项目添加,请务必选中add to targetsDestination: copy items if needed

此处有关于这些错误的更多信息:Mystery console error with IOHIDFamily