Search code examples
iosflutterflutter-ios

Flutter IOS app won't start with image_picker: ^0.6.3+4


The Flutter app is not starting when I try to use Image_Picker on the IOS side. On the Android side everything works fine.

I have added following permissions inside info.plist.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <!-- for Image Picker -->  
    <key>NSPhotoLibraryUsageDescription</key>
    <String>This app requires access to the photo library</String>
    <key>NSCameraUsageDescription</key>
    <string>This app requires access to the camera</string>
    <key>NSMicrophoneUsageDescription</key>
    <string>This app does not require access to the microphone</string>
    
    <key>CFBundleDevelopmentRegion</key>
    <string>$(DEVELOPMENT_LANGUAGE)</string>

When I remove the above properties form info.plist, the app works fine until I use the camera. But if I add the properties into info.plist the app won't start.

I am getting following error when I am trying to run the IOS app.

/Users/abcshah/Library/Developer/Xcode/DerivedData/Runner-btwtkgmqdpzzlbcimpfmyibbmiua/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/assetcatalog_generated_info.plist

error: unable to read property list from file: /Volumes/abc/projects/new/iconspro/ios/Runner/Info.plist: The operation couldn’t be completed. (XCBUtil.PropertyListConversionError error 1.) (in target 'Runner' from project 'Runner')

note: Using new build system

note: Planning build

note: Constructing build description

Could not build the application for the simulator. Error launching application on iPhone 8 Plus.


Solution

  • It seems that my first guess was not completely off. I am using the image_picker plugin in my project as well and was able to produce a bunch of errors by changing the tag from string

    <key>NSPhotoLibraryUsageDescription</key> 
    <string>This app requires access to the camera.</string>
    

    to String

    <key>NSPhotoLibraryUsageDescription</key> 
    <String>This app requires access to the camera.</String>
    

    Therefore i recommend to pay attention to the casing of your tags.
    Make sure all <string> tags are lower cased.