QML Camera crash on iOS 11.
-
in my current app (qt 5.9), i use the Camera component as describe in https://doc.qt.io/qt-5/qml-qtmultimedia-cameracapture.html. However the app crash whenever I reach the page that includes this component. The thing is when I comment out the Camera component, my app doesn't crash (but of course, it does not take photos either). But everything works fine with iOS12. Have any faced the same problem? And could you show me how to fix it?
-
hi and welcome,
a basic question first. Did you add the camera permission to yourinfo.proinfo.plist file? -
hi @J-Hilk
I have the camera mission in my Info.plist file. However, I'm not aware of the info.pro file? Did you mean my Project.pro file?
And right before moving to the screen that contain the component, I double check the camera permission (as discussed in https://stackoverflow.com/questions/20464631/detect-permission-of-camera-in-ios). And indeed I do have the camera access permission. But the app just keep crashing -
@J.Hilk
oh and one more thing.
I include the whole Item (as in https://doc.qt.io/qt-5/qml-qtmultimedia-cameracapture.html). But when I remove the Camera element from the Item, the app doesn't crash. -
I'm sorry, I miswrote that one, I meant the info.plist
You said you checked that, usually the permission popup than comes automatically (on iOS)
2 more questions:
- did you add
QT += multimedia
to your pro file? - But everything works fine with iOS12. -- What does that mean exactly ? Your code works in iOS12 but not in other versions ?
- did you add
-
I did add Qt += multimedia in my .pro file
And yes, the code works well with iOS 12.
I forgot to mention, the code works when i test with my real device.
However, since I don't have an iOS 11 phone, with the iOS 11 case, I have to test with a simulator. And I have not tested with lower version.
Do you think maybe the Camera QML element does not work with simulators? -
Hi,
On recent version of iOS you have to add the NSCameraUsageDescription` entry to your Info.plist file. While it was optional earlier, it's not the case anymore and the OS will make your application will crash if it's missing.
-
hi @SGaist
I did add that to my Info.plist file. And in the app, I even ask for user permission to access camera before proceeding to the page that include the Camera. It does indeed work fine with iOS 12 devices, but does not so with simulators :( I need to verify if the app still works with older iOS versions -
@vudangkhoa2906 I'm not sure the simulator actually supports the camera.
I know for example, that it doesn't forward the Bluetooth module - at least out of the box, haven't looked into it much.
-
Yes, now that I have tried to build and run a simple example that comes with Qt itself, the example did indeed work with my real device, but not with simulators.