I'm integrating QCAR into one screen of a Cocos2d project by adding an ARParentViewController as a subview of the shared director view. Everything builds properly but when I get to that screen in my app, QCAR inits and then shuts down with the error message "Failed to register callback because the given camera is invalid".
The device is an iPad 3 on iOS 6 and sample code works fine on the device. My first thought is that cocos2d is doing something with the camera that makes it unavailable to other SDKs. I'm not personally interacting with the camera anywhere else in the app.
Any other ideas?
Relevant logs:
2012-09-25 15:22:23.213 App[267:907] ARVC: loadView
2012-09-25 15:22:23.234 App[267:907] QCAR OpenGL flag: 2
2012-09-25 15:22:23.236 App[267:907] ARVC: viewDidLoad
2012-09-25 15:22:23.238 App[267:907] QCARutils onCreate()
2012-09-25 15:22:23.240 App[267:907] APPSTATUS_INIT_APP
2012-09-25 15:22:23.241 App[267:907] APPSTATUS_INIT_QCAR
2012-09-25 15:22:23.244 App[267:907] ARParentVC: loading
2012-09-25 15:22:23.246 App[267:907] ARParent: Rotating to Landscape Right
2012-09-25 15:22:23.248 App[267:907] ARParentVC: appearing
2012-09-25 15:22:23.250 App[267:907] ARParent: Rotating to Landscape Right
2012-09-25 15:22:23.251 App[267:907] ARVC: viewWillAppear
2012-09-25 15:22:23.253 App[267:907] ARVC: viewWillAppear
2012-09-25 15:22:23.268 App[267:907] cocos2d: surface size: 2048x1536
2012-09-25 15:22:23.279 App[267:907] EAGLView: layoutSubviews
2012-09-25 15:22:23.286 App[267:907] ARVC: viewDidAppear
2012-09-25 15:22:23.288 App[267:907] QCARutils onResume()
2012-09-25 15:22:23.290 App[267:907] ARParentVC: appeared
2012-09-25 15:22:23.292 App[267:907] ARVC: viewDidAppear
2012-09-25 15:22:23.296 App[267:907] QCARutils onDestroy()
2012-09-25 15:22:23.307 App[267:6903] INFO/AR(267) 2012-09-25 15:22:23: QCAR SDK version 1.5.9
2012-09-25 15:22:23.308 App[267:907] ERROR/AR(267) 2012-09-25 15:22:23: Failed to register callback because the given camera is invalid.
2012-09-25 15:22:23.313 App[267:907] cocos2d: deallocing <CCScaleTo = 0x11833d0 | Tag = -859111423>
2012-09-25 15:22:23.422 App[267:6903] ERROR/AR(267) 2012-09-25 15:22:23: Failed to initialize because this device has no valid camera.
"the given camera is invalid" on iOS 6 / iPad 3
Hi Nick,
If the sample code works fine then it must be the integration.
Just looking at your log the thing that stands out is this line:
QCARutils onDestroy()
"the given camera is invalid" on iOS 6 / iPad 3
There are some weird issues with the camera when trying to display from within cocos2d. I don't think I can fully debug them from the outside of QCAR.
"the given camera is invalid" on iOS 6 / iPad 3
Thanks for sharing.
Did you solve the OnDestoy() issue?
N
"the given camera is invalid" on iOS 6 / iPad 3
Nope, I can't figure out why that occurs from within cocos2d. It doesn't occur when you use the same code but place the view outside of the cocos2d container.