在app中启动Cocos2d 3.0 会crash

本人在开发一个应用 以前都是使用UIKit来画界面的
但是最近客户要求在进入游戏界面的viewcontroller时 部分界面使用 cocos2d进行渲染

进入界面流程是这样的:
Login ->menu->game viewcontroller

然后我在game viewcontroller中启动cocos2d

代码:

  • (void)test_init_addCocos2D{
    CCGLView *glView = [CCGLView
    viewWithFrame:
    pixelFormat:kEAGLColorFormatRGBA8
    depthFormat:0
    preserveBackbuffer:NO
    sharegroup:nil
    multiSampling:NO
    numberOfSamples:0];

CCDirectorIOS* director = (CCDirectorIOS*) ;

director.wantsFullScreenLayout = YES;

//#if DEBUG
// Display FSP and SPF
;
//#endif

// set FPS at 60
;

director.fixedUpdateInterval = 1.0/60.0;

// attach the openglView to the director
;

// if( isEqual:CCScreenModeFixed]){
// CGSize size = .viewSizeInPixels;
// CGSize fixed = FIXED_SIZE;
//
// if( isEqualToString:CCScreenOrientationPortrait]){
// CC_SWAP(fixed.width, fixed.height);
// }

// Find the minimal power-of-two scale that covers both the width and height.
// CGFloat scaleFactor = MIN(FindPOTScale(size.width, fixed.width), FindPOTScale(size.height, fixed.height));

// director.contentScaleFactor = scaleFactor;
director.UIScaleFactor = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone ? 1.0 : 0.5);

// Let CCFileUtils know that “-ipad” textures should be treated as having a contentScale of 2.0.
setiPadContentScaleFactor: 2.0];

// director.designSize = fixed;
;
// } else {
// // Setup tablet scaling if it was requested.
// if(
// UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad &&
// boolValue]
// ){
// // Set the director to use 2 points per pixel.
// director.contentScaleFactor *= 2.0;
//
// // Set the UI scale factor to show things at “native” size.
// director.UIScaleFactor = 0.5;
//
// // Let CCFileUtils know that “-ipad” textures should be treated as having a contentScale of 2.0.
// setiPadContentScaleFactor:2.0];
// }
//
// ;
// }

// Default texture format for PNG/BMP/TIFF/JPEG/GIF images
// It can be RGBA8888, RGBA4444, RGB5_A1, RGB565
// You can change this setting at any time.
;

// Initialise OpenAL
;

;

 runWithScene:];

}

  • (void)viewDidLoad
    {
    ;

self.view.backgroundColor = ;

;
}

而这个IntroScene是我用模板生成的场景,但是当它在加载background的时候会crash

// Create a colored background (Dark Grey)
CCNodeColor *background = ];
;

-(void) addChild: (CCNode*)child z:(NSInteger)z name:(NSString*)name
{
NSAssert( child != nil, @“Argument must be non-nil”);
NSAssert( child.parent == nil, @“child already added to another node. It can’t be added again”);

if( ! _children )
;

;

child.name = name;

;

;

// Update pausing parameters
child->_pausedAncestors = _pausedAncestors + (_paused ? 1 : 0);
RecursivelyIncrementPausedAncestors(child, child->_pausedAncestors);

if( _isInActiveScene ) {
;
;
}

CCDirector sharedDirector] responderManager] markAsDirty];(然后它就crash在这行代码里了 说是EXC_BAD_ACCESS ,只要一调用 CCDirector sharedDirector] responderManager] 就会crash)

}

有大神知道怎么解决么?