NSGenericException reason Collection< 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'而终止应用程序,原因:'* 集合< 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
推荐答案
从我能说的精灵k中的sprite kit bug方法:
From what I can tell this a sprite kit bug in the sprite kit method:
preloadTextures: withCompletionHandler:
我能够解决这个问题的唯一方法就是完全删除这个方法。
根据apple docs,如果你访问 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 reason Collection< NSConcreteMapTable:xxx>的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!