ios - Sprite Kit iOS 7.1 在 wasRemovedFromTargetAtTime 上崩溃
<p><p>我在 iOS 7.1 上的 Sprite Kit 中发生了崩溃。我尝试使用 Xcode 5.0.2 和 5.1 构建。结果是一样的。在 iOS 7.1 设备上仍然崩溃。 </p>
<p>这里附上截图。</p>
<p> <img src="/image/AVSGD.png" alt="enter image description here"/>
<img src="/image/ECSQT.png" alt="enter image description here"/> </p>
<p>我找到了导致崩溃的代码。</p>
<pre><code>- (WATDirection *)panDown {
WATDirection *direction = [ init];
CGFloat newY = 830;
@weakify(self)
[direction addStartHandler:^(WATDirection *direction) {
@strongify(self)
self.panningDown = YES;
withKey:@"next_arrow"];
// Move the scene
SKAction *panDown = ;
panDown.timingMode = SKActionTimingEaseInEaseOut;
;
// Fade in the pipes
SKNode *pipes = ;
SKAction *fadeIn = [SKAction sequence:@[
,
]];
;
[pipes enumerateChildNodesWithName:@"pipe" usingBlock:^(SKNode *node, BOOL *stop) {
SKAction *fadeIn = [SKAction sequence:@[
,
,
]];
;
}];
// Fade out the overlay
SKNode *pipesOverlay = ;
SKAction *fadeOut = [SKAction sequence:@[
,
,
]];
;
[self runAction:[SKAction sequence:@[
,
[SKAction runBlock:^{
;
}]
]]];
}];
[direction addFinishHandler:^(WATDirection *direction) {
@strongify(self)
withKey:@"next_arrow"];
self.panningDown = NO;
self.pannedDown = YES;
}];
[direction addCancelHandler:^(WATDirection *direction) {
@strongify(self)
SKAction *panDown = ;
;
SKNode *pipesOverlay = ;
;
withKey:@"next_arrow"];
self.panningDown = NO;
self.pannedDown = YES;
}];
return direction;
</code></pre>
<p>}</p>
<p>这两行是问题:</p>
<pre><code>@strongify(self)
withKey:@"next_arrow"];
</code></pre>
<p>对此有什么想法吗?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>发现问题。有 2 个 Action 具有相同的 animationKey @"next_arrow"。</p>
<pre><code> withKey:@"next_arrow"];
</code></pre>
<p>第二个 Action 在第一个 Action 完成之前开始。第二个 Action 尝试从队列中删除带有该键的动画,但没有使用该键的 Action ,因为第一个 Action 从队列中删除了该键。</p>
<p>解决方法是重命名第二个动画的操作键。</p>
<pre><code> withKey:@"next_arrow_down"];
</code></pre>
<p>感谢大家的支持!</p></p>
<p style="font-size: 20px;">关于ios - Sprite Kit iOS 7.1 在 wasRemovedFromTargetAtTime 上崩溃,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/22615396/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/22615396/
</a>
</p>
页:
[1]