Ios6 UIViewController崩溃中的Cocos3D集成
嗨,我正在尝试将Cocos3D集成到我当前的项目中 当我在App Delegate中将包含Cocos3D代码(如下所列)的UIViewControllerCocs设置为UINavigationController的根目录时,我可以成功运行它 但是,如果我使用其他一些viewController,比如说OtherVC,并在navigationController上推UIViewControllerCocs,那么它就会崩溃Ios6 UIViewController崩溃中的Cocos3D集成,ios6,cocos3d,Ios6,Cocos3d,嗨,我正在尝试将Cocos3D集成到我当前的项目中 当我在App Delegate中将包含Cocos3D代码(如下所列)的UIViewControllerCocs设置为UINavigationController的根目录时,我可以成功运行它 但是,如果我使用其他一些viewController,比如说OtherVC,并在navigationController上推UIViewControllerCocs,那么它就会崩溃 _viewController.supportedInterfaceOrie
_viewController.supportedInterfaceOrientations = UIInterfaceOrientationMaskAll; //APPLICATION CRASH HERE SAYING -[CCDirectorDisplayLink setSupportedInterfaceOrientations:]: unrecognized selector sent to instance 0x146ab0b0. Where
_viewController is CC3DeviceCameraOverlayUIViewController* _viewController;
我使用了CoCo3D hello world代码
//UIViewControllerCOCOS.m
-(void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self setupCocos3D];
}
-(void)setupCocos3D{
CCTexture2D.defaultAlphaPixelFormat = kCCTexture2DPixelFormat_RGBA8888;
// Establish the view controller and CCDirector (in cocos2d 2.x, these are one and the same)
[self establishDirectorController];
[self.view addSubview:_viewController.view];
// ******** START OF COCOS3D SETUP CODE... ********
// Create the customized CC3Layer that supports 3D rendering.
cc3Layer = [Nabru_cocos3dLayer layerWithController: _viewController];
// Create the customized 3D scene and attach it to the layer.
// Could also just create this inside the customer layer.
cc3Layer.cc3Scene = [Nabru_cocos3dScene scene];
// Assign to a generic variable so we can uncomment options below to play with the capabilities
CC3ControllableLayer* mainLayer = cc3Layer;
_viewController.controlledNode = mainLayer;
// Run the layer in the director
CCScene *scene = [CCScene node];
[scene addChild: mainLayer];
[CCDirector.sharedDirector runWithScene: scene];
}
-(void) establishDirectorController {
_viewController = CC3DeviceCameraOverlayUIViewController.sharedDirector;
_viewController.supportedInterfaceOrientations = UIInterfaceOrientationMaskAll; //APPLICATION CRASH HERE SAYING -[CCDirectorDisplayLink setSupportedInterfaceOrientations:]: unrecognized selector sent to instance 0x146ab0b0. If i comment out this line then it crash second line below it.
_viewController.viewShouldUseStencilBuffer = NO; // Set to YES if using shadow volumes
_viewController.viewPixelSamples = 1; // Set to 4 for antialiasing multisampling
_viewController.animationInterval = (1.0f / kAnimationFrameRate);
_viewController.displayStats = YES;
[_viewController enableRetinaDisplay: YES];
}
有什么建议吗?有错误日志吗?正如我在问题中提到的那样,“\u viewController.supportedInterfaceOrientions=UIInterfaceOrientationMaskAll;//应用程序崩溃这里说-[CCDirectorDisplayLink SetSupportedInterfaceOrientions:]:发送到实例0x146ab0b0的选择器无法识别。如果我注释掉这一行,则它会在下面的第二行崩溃。“