iphone - ReplaceScene 错误:由于未捕获的异常 'NSRangeException' 而终止应用程序,原因:'***-[NSMutableArray ReplaceObjectAtIndex:withObject:]

发布于 2024-12-07 09:47:37 字数 3241 浏览 0 评论 0原文

我制作了一个加载屏幕,程序在其中遍历单词列表,选择一个六个字母的单词,并从该单词的字母派生出一个单词列表。

问题是,在所有初始化之后,当它尝试更改场景时,它会吐出错误:

Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSMutableArray replaceObjectAtIndex:withObject:]: index 4294967295 beyond bounds for empty array'

我尝试将replaceScene更改为pushScene以及runWithScene,但它们都吐出错误并且不继续进行游戏场景。

这是堆栈:

    2011-09-28 20:28:57.890 WordSearchPuzzleManiaIPhone[3524:207] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSMutableArray replaceObjectAtIndex:withObject:]: index 4294967295 beyond bounds for empty array'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x014f75a9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x0164b313 objc_exception_throw + 44
    2   CoreFoundation                      0x014f0626 -[__NSArrayM replaceObjectAtIndex:withObject:] + 326
    3   WordSearchPuzzleManiaIPhone         0x00028cc4 -[CCDirector replaceScene:] + 308
    4   WordSearchPuzzleManiaIPhone         0x000d6a9f -[LoadingScene powerSetForArray] + 4031
    5   WordSearchPuzzleManiaIPhone         0x000d58da -[LoadingScene init] + 842
    6   WordSearchPuzzleManiaIPhone         0x000406d1 +[CCNode node] + 81
    7   WordSearchPuzzleManiaIPhone         0x000d554d +[LoadingScene scene] + 93
    8   WordSearchPuzzleManiaIPhone         0x000c1faf -[AppDelegate applicationDidFinishLaunching:] + 1583
    9   UIKit                               0x00749ce2 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1252
    10  UIKit                               0x0074bd88 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439
    11  UIKit                               0x00756617 -[UIApplication handleEvent:withNewEvent:] + 1533
    12  UIKit                               0x0074eabf -[UIApplication sendEvent:] + 71
    13  UIKit                               0x00753f2e _UIApplicationHandleEvent + 7576
    14  GraphicsServices                    0x02012992 PurpleEventCallback + 1550
    15  CoreFoundation                      0x014d8944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
    16  CoreFoundation                      0x01438cf7 __CFRunLoopDoSource1 + 215
    17  CoreFoundation                      0x01435f83 __CFRunLoopRun + 979
    18  CoreFoundation                      0x01435840 CFRunLoopRunSpecific + 208
    19  CoreFoundation                      0x01435761 CFRunLoopRunInMode + 97
    20  UIKit                               0x0074b7d2 -[UIApplication _run] + 623
    21  UIKit                               0x00757c93 UIApplicationMain + 1160
    22  WordSearchPuzzleManiaIPhone         0x000c191f main + 127
    23  WordSearchPuzzleManiaIPhone         0x000025a5 start + 53
    24  ???                                 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'

如果有人需要的话,这是文件:http://www.mediafire.com/?z4ef1zutwb544gt

希望有人能帮我解决这个问题。

太感谢了!

〜一夫

编辑: 自己解决了!刚刚使用了LoadingScene场景的onEnter()。:)

I made a loading screen, where the program goes through a list of words, picks a six-letter word, and derives a list of words from the letters of that word.

Problem is, after all the initialization, when it gets to trying to change the scene, it spits out the error:

Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSMutableArray replaceObjectAtIndex:withObject:]: index 4294967295 beyond bounds for empty array'

I have tried changing replaceScene to pushScene as well as runWithScene, but all of them spit out errors and do not proceed to the game scene.

Here's the stack:

    2011-09-28 20:28:57.890 WordSearchPuzzleManiaIPhone[3524:207] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSMutableArray replaceObjectAtIndex:withObject:]: index 4294967295 beyond bounds for empty array'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x014f75a9 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x0164b313 objc_exception_throw + 44
    2   CoreFoundation                      0x014f0626 -[__NSArrayM replaceObjectAtIndex:withObject:] + 326
    3   WordSearchPuzzleManiaIPhone         0x00028cc4 -[CCDirector replaceScene:] + 308
    4   WordSearchPuzzleManiaIPhone         0x000d6a9f -[LoadingScene powerSetForArray] + 4031
    5   WordSearchPuzzleManiaIPhone         0x000d58da -[LoadingScene init] + 842
    6   WordSearchPuzzleManiaIPhone         0x000406d1 +[CCNode node] + 81
    7   WordSearchPuzzleManiaIPhone         0x000d554d +[LoadingScene scene] + 93
    8   WordSearchPuzzleManiaIPhone         0x000c1faf -[AppDelegate applicationDidFinishLaunching:] + 1583
    9   UIKit                               0x00749ce2 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1252
    10  UIKit                               0x0074bd88 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439
    11  UIKit                               0x00756617 -[UIApplication handleEvent:withNewEvent:] + 1533
    12  UIKit                               0x0074eabf -[UIApplication sendEvent:] + 71
    13  UIKit                               0x00753f2e _UIApplicationHandleEvent + 7576
    14  GraphicsServices                    0x02012992 PurpleEventCallback + 1550
    15  CoreFoundation                      0x014d8944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
    16  CoreFoundation                      0x01438cf7 __CFRunLoopDoSource1 + 215
    17  CoreFoundation                      0x01435f83 __CFRunLoopRun + 979
    18  CoreFoundation                      0x01435840 CFRunLoopRunSpecific + 208
    19  CoreFoundation                      0x01435761 CFRunLoopRunInMode + 97
    20  UIKit                               0x0074b7d2 -[UIApplication _run] + 623
    21  UIKit                               0x00757c93 UIApplicationMain + 1160
    22  WordSearchPuzzleManiaIPhone         0x000c191f main + 127
    23  WordSearchPuzzleManiaIPhone         0x000025a5 start + 53
    24  ???                                 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'

Here's the file if anyone needs it: http://www.mediafire.com/?z4ef1zutwb544gt

Hope someone can help me out with this.

Thank you so much!

~Kazuo

EDIT:
Solved it myself! Just used the onEnter() of the LoadingScene scene.:)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

怕倦 2024-12-14 09:47:37

您的此调用是 [CCTransitionCrossFadetransitionWithDuration:1 scene:[GameScene node]] 返回一些无效值,该值不在范围内。所以它正在崩溃。

纳文

Your this call is [CCTransitionCrossFade transitionWithDuration:1 scene:[GameScene node]] returning some invalid values, that is not there in the range. So it is crashing.

Naveen

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文