开发者

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

开发者 https://www.devze.com 2023-04-09 14:50 出处:网络
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.

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 an开发者_如何学JAVAd 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.:)


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

0

精彩评论

暂无评论...
验证码 换一张
取 消