skip to Main Content

I wanted to test the app for iOS and I installed Xcode.

The problem is that I have a few buildtime warnings and 2 bugs only on iOS.
First, the camera is not opening and I’m receiving this error without any stack trace as you see in the picture below. And the second problem is that images added in shared preferences are not displaying when I rebuild the project.

I see that some functions are not compatible with the deployment target, 12.0 in my case. I don’t know Swift at all.
I added in ios/Runner/Info.plist these settings:

<key>NSCameraUsageDescription</key>
<string>Allow access to camera to capture photos</string>
<key>NSMicrophoneUsageDescription</key>
<string>Allow access to microphone</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Allow access to photo library</string>

The dependencies are setted to any to match the last stable version.

dependencies:
  flutter:
    sdk: flutter
  image_picker: any
  shared_preferences: any
  image_collage_widget: any
  screenshot: any
  persistent_bottom_nav_bar: any
  flutter_staggered_grid_view: any
  image_gallery_saver: any
  sqflite: any
  path: any
  dropdown_button2: any
  rflutter_alert: any
  animated_widgets: any
  flutter_launcher_icons: any

So, why my camera is not opening on iOS, how to get rid of these warnings and why my shared preferences images are not rendered on iOS?

Edit: If I test on real iOS mobile device, the camera is working…

enter image description here

enter image description here

enter image description here

2

Answers


  1. Chosen as BEST ANSWER

    I solved the problems:

    • the images are now rendering from shared preferences, the problem was that I was saving them as string paths, instead of saving them as base64strings.

    • the iOS simulator doesn't have a camera as @Ujjawal Maurya said in an answer.

    The warnings are still there, but I can ignore them as the app is still running well. It's a good practice to change the deprecated functions, but I don't know Swift at all.


  2. Warnings: These are just warnings, you can ignore them. Project will run.
    ( You can work on those warnings)

    Camera issue: is because simulator doesn’t have camera.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search