我正在制作的俄罗斯方块游戏出现此错误。不确定如何将Xcode项目上传到GitHub,因为我无法访问,因此我没有上下文,所以很抱歉。这个错误似乎对我来说没有任何意义,它只是一个随机的数字集合和一些可识别的短语,例如' SpriteKit'或者' UIKit'。
2017-05-15 10:09:10.942 Tetris[2258:77198] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Setting this node as parent would create a loop: <SKNode> name:'(null)' position:{6, -6} scale:{1.00, 1.00} accumulatedFrame:{{12, -412}, {200, 400}}'
*** First throw call stack:
(
0 CoreFoundation 0x000000010fa4dd4b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010cacb21e objc_exception_throw + 48
2 CoreFoundation 0x000000010fab72b5 +[NSException raise:format:] + 197
3 SpriteKit 0x000000010cfe3134 -[SKNode(setParent) setParent:] + 87
4 SpriteKit 0x000000010cfdc376 -[SKNode insertChild:atIndex:] + 230
5 SpriteKit 0x000000010cfdc26f -[SKNode addChild:] + 68
6 Tetris 0x000000010c4bafe0 _TFC6Tetris9GameScenecfT4sizeVSC6CGSize_S0_ + 1376
7 Tetris 0x000000010c4bb080 _TFC6Tetris9GameSceneCfT4sizeVSC6CGSize_S0_ + 64
8 Tetris 0x000000010c4c23f2 _TFC6Tetris18GameViewController11viewDidLoadfT_T_ + 274
9 Tetris 0x000000010c4c3222 _TToFC6Tetris18GameViewController11viewDidLoadfT_T_ + 34
10 UIKit 0x000000010d368a3d -[UIViewController loadViewIfRequired] + 1258
11 UIKit 0x000000010d368e70 -[UIViewController view] + 27
12 UIKit 0x000000010d2324b5 -[UIWindow addRootViewControllerViewIfPossible] + 71
13 UIKit 0x000000010d232c06 -[UIWindow _setHidden:forced:] + 293
14 UIKit 0x000000010d246519 -[UIWindow makeKeyAndVisible] + 42
15 UIKit 0x000000010d1bef8d -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4818
16 UIKit 0x000000010d1c50ed -[UIApplication _runWithMainScene:transitionContext:completion:] + 1731
17 UIKit 0x000000010d1c226d -[UIApplication workspaceDidEndTransaction:] + 188
18 FrontBoardServices 0x0000000116a4b6cb __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
19 FrontBoardServices 0x0000000116a4b544 -[FBSSerialQueue _performNext] + 189
20 FrontBoardServices 0x0000000116a4b8cd -[FBSSerialQueue _performNextFromRunLoopSource] + 45
21 CoreFoundation 0x000000010f9f2761 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
22 CoreFoundation 0x000000010f9d798c __CFRunLoopDoSources0 + 556
23 CoreFoundation 0x000000010f9d6e76 __CFRunLoopRun + 918
24 CoreFoundation 0x000000010f9d6884 CFRunLoopRunSpecific + 420
25 UIKit 0x000000010d1c0aea -[UIApplication _run] + 434
26 UIKit 0x000000010d1c6c68 UIApplicationMain + 159
27 Tetris 0x000000010c4c858f main + 111
28 libdyld.dylib 0x00000001109fd68d start + 1
29 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
答案 0 :(得分:1)
改编自Official Documentation,NSInvalidArgumentException
是:
传递无效参数时发生的异常的名称 一个方法,例如nil指针,需要一个非零对象。
它还应该有原因它发生的原因。
根据您的情况,原因是:
将此节点设置为父节点将创建一个循环: 名称:'(null)'位置:{6,-6}比例:{1.00,1.00} accumulationFrame:{{12,-412},{200,400}}
尝试调试崩溃的场景,原因应该足够清楚,以便检测导致崩溃的原因。