googlevr / gvr-ios-sdk

Google VR SDK for iOS
http://developers.google.com/vr/ios/
Other
645 stars 191 forks source link

Cannot scan QR code #243

Closed nfrechette closed 7 years ago

nfrechette commented 7 years ago

Hello, We have a native iOS app which uses the GVROverlayView. The view displays fine, the back button works fine and properly fires the callback. The settings button works fine and pops up the bottom panel which shows which cardboard device is used along with a more info button that properly opens a web page.

However, pressing the cardboard device to change it does not work. The panel just disappears and nothing happens. This also happens when the app launches. On the transition panel, if I press the 'Switch' button, nothing happens.

Neither scenario asks me for camera permissions (and I can confirm that it hasn't been disabled prior to this). It seems the code doesn't get that far.

If I run the Panorama sample on the same device, everything works as expected.

Sadly it seems that GVROverlayView isn't even documented in the SDK reference and there doesn't appear to be any way to control whether the transition screen is shown or not.

No error messages or warnings or anything of the sort is outputted as far as I can tell. The app continues to run.

Any ideas? This is using the latest SDK. Note that we aren't building our app with cocoapods, we manually link against the libs and include the bundles.

Note that we use Metal to render internally. Everything related to the view creation is done using dispatch_async with the main queue.

nfrechette commented 7 years ago

I tried using the GVRWidgetView instead and enabling the VR mode. In the transition panel, if I press the 'Switch' button, it properly loads up the QR scanner view but if I skip or move past the transition screen, I crash with this error message:

2017-05-03 15:23:12.525239 myapp_ios_debug[1020:414207] Assertion failure in -[GVRWidgetView renderer], googlemac/iPhone/CardboardSDK/Source/GVRWidgetView.mm:531 2017-05-03 15:23:12.527081 myapp_ios_debug[1020:414207] Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Subclasses should return their instance of widget_renderer' *** First throw call stack: (0x18dc411b8 0x18c67855c 0x18dc4108c 0x18e6f902c 0x104b944f8 0x104b94018 0x104b8a4f0 0x104b8b5c0 0x101ecfae4 0x190e96f24 0x190e96dd0 0x18deae094 0x18dbd6e50 0x18dbef218 0x18dbee9cc 0x18dbec4b0 0x18db1a2b8 0x18db67b44 0x18e754e68 0x18ccd5850 0x18ccd5760 0x18ccd2d94) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

nfrechette commented 7 years ago

I can confirm that UE4 doesn't have the issue with the same GVR SDK version using the GVROverlayView.

sanjayc77 commented 7 years ago

GVROverlayView is not exposed through the iOS SDK. You do have to make sure the App's info.plist has the camera permission. The SDK, being a SDK, cannot do this on behalf of the app.

Re:crash, do you have the full call stack? Thanks.

nfrechette commented 7 years ago

The camera permission is present and isn't the issue IMO. If it was missing, the app would crash when requesting the permission. It also never makes it far enough as to ask me to allow the app to use the camera. The issue is prior to reaching the QR scanning view.

If I can get the callstack, I'll add it here but ideally I'd like to just use the overlay, it is sufficient for my needs if it works.

nfrechette commented 7 years ago

After further investigation, it turns out our application was never calling [window makeKeyAndVisible]. Calling this fixes the issue for us.