SKEffectNode 遍历子级崩溃(iOS10 Spritekit)

SKEffectNode walk through children crashed (iOS10 Spritekit)

我有一个 SKEffectNode,其中包含一个节点,该节点将随时间动态更改其子节点(经常删除子节点并动态添加子节点)。我不断在 Fabric 上获取此崩溃日志(仅发生在 iOS10 上),但我无法在自己的设备上重现它。日志似乎正在尝试计算该节点的边界并出现一些错误。 有没有人有同样的情况?请给我合理的建议和建议。谢谢!

0  SpriteKit                      0x190fc2810 SKCNode::walkChildren(void (SKCNode*, bool*) block_pointer, bool, bool) + 100
1  SpriteKit                      0x190fc2b50 SKCNode::getAccumulatedBoundingBox() + 176
2  SpriteKit                      0x190fc3114 ___ZN7SKCNode25getAccumulatedBoundingBoxEv_block_invoke + 36
3  SpriteKit                      0x190fc2858 SKCNode::walkChildren(void (SKCNode*, bool*) block_pointer, bool, bool) + 172
4  SpriteKit                      0x190fc2b50 SKCNode::getAccumulatedBoundingBox() + 176
5  SpriteKit                      0x190fc3114 ___ZN7SKCNode25getAccumulatedBoundingBoxEv_block_invoke + 36
6  SpriteKit                      0x190fc2858 SKCNode::walkChildren(void (SKCNode*, bool*) block_pointer, bool, bool) + 172
7  SpriteKit                      0x190fc2b50 SKCNode::getAccumulatedBoundingBox() + 176
8  SpriteKit                      0x190fc3114 ___ZN7SKCNode25getAccumulatedBoundingBoxEv_block_invoke + 36
9  SpriteKit                      0x190fc2858 SKCNode::walkChildren(void (SKCNode*, bool*) block_pointer, bool, bool) + 172
10 SpriteKit                      0x190fc2b50 SKCNode::getAccumulatedBoundingBox() + 176
11 SpriteKit                      0x19102a090 ___ZN13SKCEffectNode19ensure_framebuffersEP13SKCRenderInfoDv4_j_block_invoke + 36
12 SpriteKit                      0x190fc2858 SKCNode::walkChildren(void (SKCNode*, bool*) block_pointer, bool, bool) + 172
13 SpriteKit                      0x191029ca0 SKCEffectNode::ensure_framebuffers(SKCRenderInfo*, unsigned int vector[4]) + 268
14 SpriteKit                      0x19102a1d0 SKCEffectNode::addRequistePasses(SKCRenderInfo*, std::__1::list<std::__1::shared_ptr<SKCRenderPass>, std::__1::allocator<std::__1::shared_ptr<SKCRenderPass> > >*) + 248
15 SpriteKit                      0x19106485c SKCRenderer::doBuildRenderGroup(SKCNode*, SKCRenderState, matrix_float4x4) + 376
16 SpriteKit                      0x191064a4c SKCRenderer::doBuildRenderGroup(SKCNode*, SKCRenderState, matrix_float4x4) + 872
17 SpriteKit                      0x191064a4c SKCRenderer::doBuildRenderGroup(SKCNode*, SKCRenderState, matrix_float4x4) + 872
18 SpriteKit                      0x191064a4c SKCRenderer::doBuildRenderGroup(SKCNode*, SKCRenderState, matrix_float4x4) + 872
19 SpriteKit                      0x191064a4c SKCRenderer::doBuildRenderGroup(SKCNode*, SKCRenderState, matrix_float4x4) + 872
20 SpriteKit                      0x191064a4c SKCRenderer::doBuildRenderGroup(SKCNode*, SKCRenderState, matrix_float4x4) + 872
21 SpriteKit                      0x191063e30 SKCRenderer::buildRenderGroup(std::__1::shared_ptr<SKCRenderSortGroup> const&) + 792
22 SpriteKit                      0x191061228 SKCRenderer::buildRenderPass(std::__1::shared_ptr<SKCRenderPass> const&) + 92
23 SpriteKit                      0x191060c94 SKCRenderer::render(SKCNode*, float vector[4], std::__1::shared_ptr<jet_framebuffer> const&, unsigned int vector[4], matrix_float4x4, bool, NSDictionary*, SKCStats*, SKCStats*, double) + 1600
24 SpriteKit                      0x190ff000c __51-[SKView _vsyncRenderForTime:preRender:postRender:]_block_invoke + 1564
25 SpriteKit                      0x190ff04a0 __51-[SKView _vsyncRenderForTime:preRender:postRender:]_block_invoke.336 + 408
26 SpriteKit                      0x190fef924 -[SKView _vsyncRenderForTime:preRender:postRender:] + 572
27 SpriteKit                      0x190ff154c __29-[SKView setUpRenderCallback]_block_invoke + 208
28 SpriteKit                      0x191027144 -[SKDisplayLink _callbackForNextFrame:] + 168
29 QuartzCore                     0x184fe6f24 CA::Display::DisplayLinkItem::dispatch(unsigned long long) + 44
30 QuartzCore                     0x184fe6dd0 CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 444
31 IOKit                          0x181ffe094 IODispatchCalloutFromCFMessage + 372
32 CoreFoundation                 0x181d26e50 __CFMachPortPerform + 180
33 CoreFoundation                 0x181d3f218 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56
34 CoreFoundation                 0x181d3e9cc __CFRunLoopDoSource1 + 436
35 CoreFoundation                 0x181d3c4b0 __CFRunLoopRun + 1840
36 CoreFoundation                 0x181c6a2b8 CFRunLoopRunSpecific + 444
37 GraphicsServices               0x18371e198 GSEventRunModal + 180
38 UIKit                          0x187cb17fc -[UIApplication _run] + 684
39 UIKit                          0x187cac534 UIApplicationMain + 208
40 Space Walk                     0x10023fb50 main (main.m:16)
41 libdispatch.dylib              0x180c4d5b8 (Missing)

我终于明白是怎么回事了。根据Apple的文档,我们只能在主线程中添加和删除节点。