unable to read property list from file, Info.plist issue when I use Mapbox sdk in my app
Asked Answered
O

6

8

im facing an issue in one of my flutter apps. Im was using MapBox-SDK plugin but when I tested the app on IOS, it asked me to update my Mapbox-sdk to some version (which I did using pop install command). Now after everything, I am facing new errors in my info.plist file. I forgot to take a backup of my old info.plist file. Anyways, the new info.plist is:

<plist version="1.0">
<dict>
<string>YES</string>
<key>io.flutter.embedded_views_preview</key>
<true/>
<key>MGLMapboxAccessToken</key>
<string>Mapbox-key-not-visible</string>
<true/>
<key>NSLocationWhenInUseUsageDescription</key>
<key>NSLocationAlwaysUsageDescription</key>
<key>NSPhotoLibraryUsageDescription</key>
<key>NSCameraUsageDescription</key>
<key>NSMicrophoneUsageDescription</key>
<string>This app needs access to location when open.</string>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>project1</string>
<key>CFBundlePackageType</key>  
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
    <string>UIInterfaceOrientationPortraitUpsideDown</string>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist

the error im facing while building up the app is:

ERROR:

Users/apple/flutter-practice/Project-Casky/casky/ios/Runner/Info.plist: Property List       error: Found non-key inside <dict> at line 10 / JSON error: JSON text did not start with array or object and option to allow fragments not set.
Xcode build done.                                           24.2s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
error: unable to read property list from file: /Users/apple/flutter-practice/Project-  Casky/casky/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: Building targets in parallel
note: Planning build
note: Constructing build description
warning: Mapping architecture armv7 to i386. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS Simulator  platform. (in target 'image_picker' from project 'Pods')
warning: Mapping architecture arm64 to x86_64. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS  Simulator platform. (in target 'image_picker' from project 'Pods')
warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in  the Runner editor. (in target 'Runner' from project 'Runner')
Could not build the application for the simulator.
Error launching application on iPhone 11 Pro Max.
Exited (sigterm)

GUYS I can't find a solution to this. Kindly help me in anyway possible. Thanks in advance.

Oddment answered 11/5, 2020 at 15:52 Comment(2)
You don't have value for NSLocationWhenInUseUsageDescription and I guess this is the problemSarmatia
@Sarmatia You're a savior!Price
S
7

The error error: unable to read property list from file: Info.plist is usually caused by missing config on the plist file. As previously mentioned in the comments, you need to have a value set on NSLocationWhenInUseUsageDescription. More details are explained in the package's docs.

<key>NSLocationWhenInUseUsageDescription</key>
<string>[Your explanation here]</string>
Shing answered 26/5, 2021 at 14:5 Comment(0)
T
3

In my case, it was because the Info.plist file was poorly formatted. It hasn't to do with XML format, because when I tried to find if that file was correctly formatted according to XML rules, it was ok, but when I tried to open the .plist file as a property list, I realized Xcode couldn't read it, so I added my keys using the property list utility, not the "code view".

Turgot answered 4/1, 2022 at 21:18 Comment(0)
M
0

I have been facing the same problem with a newly imported Flutter project. After some debugging, it seems like the issue was caused by a corrupt GoogleService-Info.plist file! Dunno why and how it was corrupted, because I have newly imported and existing project.

To solve this problem, you can follow those steps;

Open your project in XCode delete the existing GoogleService-Info.plist file download the original one from Firebase then reimport/re-copy this file into your project When this is done, run flutter clean then try running it in iOS Simulator

This worked for me, hope it solves your problem too.

Montserrat answered 15/10, 2021 at 6:52 Comment(0)
L
0

I solved this issue by including <string/> after each <key>...</key> like this :

<key>NSPhotoLibraryUsageDescription</key>
<string /> 

<key>NSCameraUsageDescription</key>
<string /> 

<key>NSMicrophoneUsageDescription</key>
<string /> 
Lilt answered 12/9, 2022 at 14:43 Comment(0)
T
0

if you add the keys without any value, it will cause this issue.

Step 1:

Open as source code

enter image description here

Step 2:

check if any keys like this without any values. Remove this key and save

<key></key>

Step 3:

Right click info plist file -> Open as Property List

Tantalite answered 9/7, 2024 at 11:34 Comment(0)
M
0

Apparently I have 2 values string for 1 key. Here's example from my incorrect Info.plist:

<key>CFBundleURLName</key>
<string>mydomain</string>
<string>com.mydomain.name</string>

What I do to resolve this is to remove one of the value that doesn't match the key so it would be like this:

<key>CFBundleURLName</key>
<string>com.mydomain.name</string>
Mangrum answered 17/7, 2024 at 2:23 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.