Implemented the example from the camera package here:
https://pub.dev/packages/camera/example
While testing on the physical device (running iOS 16), the app builds and runs fine, however the phone does not ask for any permissions to access the camera or microphone.
The following code has been added to ios/Runner/Info.plist
<key>NSCameraUsageDescription</key>
<string>Testing the Camera integration.</string>
<key>NSMicrophoneUsageDescription</key>
<string>To add sounds to the videos you record.</string>
The iOS Deployment Target
has been set to iOS 11.0
Note:
I can assure you that the app has not been granted these permissions already because:
- It is not showing up in the app settings
- The app is not listed in Settings>Privacy & Security>Camera
Am I missing something?
Update:
Created a clean projects to test out this example code, Implemented the permission_handler to force the permissions (based on recommendation from @cenk-yagmur).
The permissions window now comes up, however the example code still doesn’t work.
This leads me to believe it is either:
- The camera package doesn’t work on iOS16
- The example code is wrong.
I’m more inclined towards 2. Will be doing a custom integration and test if that fixes the issue.
3
Answers
If the system not asking the permission than it was granted before
https://pub.dev/packages/permission_handler
To avoid problems, have it checked before accessing the camera to see if it has permission.
You can add this code to the PodFile and try again.
Don’t forget to clean, pub get and pod install.
Remember just turn off the comment line for the properties you are using and set the value to 1.
My Photos and Camera permissions function code: