在iOS 7中使用[[CCDirector sharedDirector]end]时Cocos2d崩溃

在iOS 7中使用[[CCDirector sharedDirector]end]时Cocos2d崩溃,ios,cocos2d-iphone,Ios,Cocos2d Iphone,我已经用cocos2d准备了一个游戏。该应用程序基于UIView模板。实际问题是,应用程序在从一个视图控制器移动到另一个视图控制器时崩溃。游戏板是使用cocos2d准备的。从包含Cocos2d屏幕的视图控制器移动到另一个视图控制器时,我使用的是[[CCDirector sharedDirector]end] 结束导演。此代码在iOS6及以下版本上运行时没有任何错误。但是当我在iOS7上运行相同的代码时,应用程序崩溃,出现以下错误 <i>*** Terminating app due

我已经用cocos2d准备了一个游戏。该应用程序基于UIView模板。实际问题是,应用程序在从一个视图控制器移动到另一个视图控制器时崩溃。游戏板是使用cocos2d准备的。从包含Cocos2d屏幕的视图控制器移动到另一个视图控制器时,我使用的是[[CCDirector sharedDirector]end] 结束导演。此代码在iOS6及以下版本上运行时没有任何错误。但是当我在iOS7上运行相同的代码时,应用程序崩溃,出现以下错误

<i>*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView context]: unrecognized selector sent to instance 0x17804f40'
*** First throw call stack:
(
    0   CoreFoundation                      0x034205e4 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x02e368b6 objc_exception_throw + 44
    2   CoreFoundation                      0x034bd903 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
    3   CoreFoundation                      0x0341090b ___forwarding___ + 1019
    4   CoreFoundation                      0x034104ee _CF_forwarding_prep_0 + 14
    5   Hood Wordz With Frendz              0x00158ef1 -[CCTextureCache init] + 545
    6   Hood Wordz With Frendz              0x00158b58 +[CCTextureCache sharedTextureCache] + 88
    7   Hood Wordz With Frendz              0x000f6d19 -[CCDirector createStatsLabel] + 57
    8   Hood Wordz With Frendz              0x000f561d -[CCDirector setView:] + 365
    9   Hood Wordz With Frendz              0x000b6d48 -[CCDirectorIOS setView:] + 104
    10  UIKit                               0x01aaf42b -[UIViewController loadView] + 284
    11  UIKit                               0x01aaf73e -[UIViewController loadViewIfRequired] + 78
    12  UIKit                               0x01ad51a5 -[UINavigationController _layoutViewController:] + 39
    13  UIKit                               0x01ad56bb -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 235
    14  UIKit                               0x01ad57b3 -[UINavigationController _startTransition:fromViewController:toViewController:] + 78
    15  UIKit                               0x01ad672c -[UINavigationController _startDeferredTransitionIfNeeded:] + 645
    16  UIKit                               0x01ad7349 -[UINavigationController __viewWillLayoutSubviews] + 57
    17  UIKit                               0x01c1039d -[UILayoutContainerView layoutSubviews] + 213
    18  UIKit                               0x01a06dd7 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
    19  libobjc.A.dylib                     0x02e4881f -[NSObject performSelector:withObject:] + 70
    20  QuartzCore                          0x015c772a -[CALayer layoutSublayers] + 148
    21  QuartzCore                          0x015bb514 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
    22  QuartzCore                          0x015bb380 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
    23  QuartzCore                          0x01523156 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 294
    24  QuartzCore                          0x015244e1 _ZN2CA11Transaction6commitEv + 393
    25  QuartzCore                          0x01524bb4 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
    26  CoreFoundation                      0x033e853e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
    27  CoreFoundation                      0x033e848f __CFRunLoopDoObservers + 399
    28  CoreFoundation                      0x033c63b4 __CFRunLoopRun + 1076
    29  CoreFoundation                      0x033c5b33 CFRunLoopRunSpecific + 467
    30  CoreFoundation                      0x033c594b CFRunLoopRunInMode + 123
    31  GraphicsServices                    0x04eca9d7 GSEventRunModal + 192
    32  GraphicsServices                    0x04eca7fe GSEventRun + 104
    33  UIKit                               0x0199c94b UIApplicationMain + 1225
    34  Hood Wordz With Frendz              0x0000313d main + 141
    35  Hood Wordz With Frendz              0x000030a5 start + 53
)
libc++abi.dylib: terminating with uncaught exception of type NSException</i>
***由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:'-[UIView上下文]:未识别的选择器已发送到实例0x17804f40'
***第一次抛出调用堆栈:
(
0 CoreFoundation 0x034205e4例外预处理+180
1 libobjc.A.dylib 0x02e368b6 objc_异常_抛出+44
2 CoreFoundation 0x034bd903-[NSObject(NSObject)不识别选择器:+275
3 CoreFoundation 0x0341090b\uuuuuuuuuuuuuuu+1019
4 CoreFoundation 0x034104ee\u CF\u转发\u准备\u 0+14
5带Frendz 0x00158ef1-[CCTextureCache init]+545的发动机罩字Z
6带Frendz 0x00158b58+[CCTextureCache sharedTextureCache]+88的Hood Wordz
7带Frendz 0x000f6d19-[CCDirector createStatsLabel]+57的Hood Wordz
8带Frendz 0x000f561d-[CCDirector setView:][365]的Hood Wordz
9带Frendz 0x000b6d48-[CCDirectorIOS setView:+104的Hood Wordz
10 UIKit 0x01aaf42b-[UIViewController loadView]+284
11 UIKit 0x01aaf73e-[UIViewController loadViewIfRequired]+78
12 UIKit 0x01ad51a5-[UINavigationController\u layoutViewController:+39
13 UIKit 0x01ad56bb-[UINavigationController\u更新从VIEWCONTROLLER:到VIEWCONTROLLER:+235的滚动视图
14 UIKit 0x01ad57b3-[UINavigationController\u开始转换:从ViewController:到ViewController:+78
15 UIKit 0x01ad672c-[UINavigationController\u STARTDEFERREEDTRANSION(如果需要):+645
16 UIKit 0x01ad7349-[UINavigationController\uuu视图将布局子视图]+57
17 UIKit 0x01c1039d-[UILayoutContainerView布局子视图]+213
18 UIKit 0x01a06dd7-[UIView(CALayerDelegate)布局层的子层:+355
19 libobjc.A.dylib 0x02e4881f-[NSObject性能选择器:withObject:+70
20夸脱芯0x015c772a-[CALayer布局子层]+148
21夸脱核心0x015bb514 _ZN2CA516层布局(如果需要)PNS 11交易+380
22四芯0x015bb380锌2CA58层布局和显示(如果需要)PNS 11事务+26
23 QuartzCore 0x01523156_ZN2CA7Context18提交交易PNS_11交易+294
24夸脱芯0x015244e1 _ZN2CA11Transaction6Committeev+393
25夸脱核心0x01524bb4 _ZN2CA11Transaction17observer _callbackEP19 u CFRunLoopObservermPv+92
26 CoreFoundation 0x033e853e\uuuuu CFRUNLOOP\u正在调用\uu OUT\u到\uu观察者\uu回调函数\uuuu+30
27 CoreFoundation 0x033e848f__CFRunLoopDoObservers+399
28 CoreFoundation 0x033c63b4_u CFRunLoopRun+1076
29 CoreFoundation 0x033c5b33 CFRUNLOOPCRUN+467
30 CoreFoundation 0x033c594b CFRUNLOOPSRUNINMODE+123
31图形服务0x04eca9d7 GSEventRunModal+192
32图形服务0x04eca7fe GSEventRun+104
33 UIKit 0x0199c94b UIApplicationMain+1225
34带Frendz 0x0000313d main+141的Wood Wordz
35带Frendz 0x000030a5启动的发动机罩Wordz+53
)
libc++abi.dylib:以NSException类型的未捕获异常终止

你们中任何知道为什么会发生这种情况的人,请帮我解决这个问题。

你们在Xcode中设置了异常断点吗?如果您这样做,您将看到并可以发布崩溃的实际行,以及哪个无法识别的选择器被发送到哪个对象。另外,您是在设备上还是在模拟器上运行此程序?@microslop它也在设备和模拟器上崩溃…我已经应用了断点&它实际上在CCTextureCache.m类中崩溃,该类正在执行[u auxGLcontext=[[EAGLContext alloc]initWithAPI:keagrenderingapiopengles2共享组:[[view context]sharegroup];线路。