简体   繁体   English

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

[英]iphone - replaceScene error:Terminating app due to uncaught exception 'NSRangeException',reason:'***-[NSMutableArray replaceObjectAtIndex:withObject:]

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. 我曾尝试将replaceScene更改为pushScene以及runWithScene,但是它们都吐出了错误,并且没有进入游戏场景。

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 如果有人需要,这里是文件: 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.:) 刚刚使用了LoadingScene场景的onEnter()。

Your this call is [CCTransitionCrossFade transitionWithDuration:1 scene:[GameScene node]] returning some invalid values, that is not there in the range. 您的此调用是[CCTransitionCrossFade transitionWithDuration:1 scene:[GameScene节点]]返回一些无效值,该值不在范围内。 So it is crashing. 所以它崩溃了。

Naveen 纳文

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ***由于未捕获的异常'NSRangeException'而终止应用程序,原因:'*** - *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** ***由于未捕获的异常'NSRangeException'而终止应用程序,原因:'***-[NSMutableArray objectAtIndex:]:索引1超出范围[0 .. 0]' - *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSMutableArray objectAtIndex:]: index 1 beyond bounds [0 .. 0]' 由于未捕获的异常'NSRangeException'终止应用程序,原因:'*** - [NSMutableArray objectAtIndex:]:索引1超出边界[0 .. 0]' - Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSMutableArray objectAtIndex:]: index 1 beyond bounds [0 .. 0]' 由于未捕获的异常“ NSRangeException”而终止应用程序,原因:“ ***-[NSMutableArray objectAtIndex:]:索引26超出范围[0 .. 0]” - Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSMutableArray objectAtIndex:]: index 26 beyond bounds [0 .. 0]' Xcode - 由于未捕获的异常'NSRangeException'而终止应用程序 - Xcode - Terminating app due to uncaught exception 'NSRangeException' 由于未捕获的异常'NSRangeException'xcode 5而终止了应用程序 - Terminating app due to uncaught exception 'NSRangeException' xcode 5 帮助我...由于未捕获的异常'NSRangeException'终止应用, - Help me …Terminating app due to uncaught exception 'NSRangeException', 错误:由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:' - [NSCFNumber isEqualToString:]: - Error:Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFNumber isEqualToString:]: iPhone上的stringByTrimmingCharactersInSet错误“由于未捕获的异常'NSInvalidArgumentException'而终止应用程序” - “Terminating app due to uncaught exception 'NSInvalidArgumentException'” error with stringByTrimmingCharactersInSet on iPhone 由于ipad / iphone上未捕获的异常而终止应用程序 - Terminating app due to uncaught exception on ipad/iphone
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM