NSGenericException 原因集合<NSConcreteMapTable: xxx> [英] NSGenericException reason Collection <NSConcreteMapTable: xxx>
问题描述
这是我在出现 SKScene
时看到的错误,此错误随机发生并且无法复制
this is the error that i see when present SKScene
, this error occurs randomly and are not able to replicate
* 由于未捕获的异常NSGenericException"而终止应用程序,原因:* Collection <NSConcreteMapTable: 0x1459da60 > 在枚举时发生了变异.'
* Terminating app due to uncaught exception 'NSGenericException', reason: '* Collection < NSConcreteMapTable: 0x1459da60 > was mutated while being enumerated.'
发生了什么?
如果您需要任何其他信息,请告诉我
tell me if you need any other info
谢谢
*** First throw call stack:
(
0 CoreFoundation 0x025601e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x022298e5 objc_exception_throw + 44
2 CoreFoundation 0x025efcf5 __NSFastEnumerationMutationHandler + 165
3 Foundation 0x01e47f03 -[NSConcreteMapTable countByEnumeratingWithState:objects:count:] + 66
4 CoreFoundation 0x0253d77f -[__NSFastEnumerationEnumerator nextObject] + 143
5 SpriteKit 0x01d009f2 +[SKTextureAtlas(Internal) findTextureNamed:] + 232
6 SpriteKit 0x01cf709c __26-[SKTexture loadImageData]_block_invoke + 1982
7 SpriteKit 0x01d34d09 _Z14SKSpinLockSyncPiU13block_pointerFvvE + 40
8 SpriteKit 0x01cf6898 -[SKTexture loadImageData] + 228
9 SpriteKit 0x01cf65d9 __51+[SKTexture preloadTextures:withCompletionHandler:]_block_invoke + 241
10 libdispatch.dylib 0x02b117b8 _dispatch_call_block_and_release + 15
11 libdispatch.dylib 0x02b264d0 _dispatch_client_callout + 14
12 libdispatch.dylib 0x02b14eb7 _dispatch_root_queue_drain + 291
13 libdispatch.dylib 0x02b15127 _dispatch_worker_thread2 + 39
14 libsystem_c.dylib 0x02de1e72 _pthread_wqthread + 441
15 libsystem_c.dylib 0x02dc9daa start_wqthread + 30
)
libc++abi.dylib: terminating with uncaught exception of type NSException
推荐答案
据我所知,这是 sprite kit 方法中的一个 sprite kit 错误:
From what I can tell this a sprite kit bug in the sprite kit method:
preloadTextures: withCompletionHandler:
我能够解决此问题的唯一方法是完全删除此方法.根据苹果文档,如果您访问 size
属性,纹理也会被加载.所以我的解决方法就是这样做:
The only way I was able to fix this was by removing this method completely.
According to apple docs the textures also get loaded if you access the size
property.
So my workaround is just to do exactly that:
for (SKTexture *texture in self.texturesArray) {
texture.size;
}
它不漂亮,但它有效!
这篇关于NSGenericException 原因集合<NSConcreteMapTable: xxx>的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!