我制作了一个加载屏幕,程序在其中浏览一个单词列表,选择一个六个字母的单词,然后从该单词的字母中导出一个单词列表。
问题是,在所有初始化之后,当它试图改变场景时,它会吐出错误:
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()。:)