繁体   English   中英

当我在我的应用程序中使用 Mapbox sdk 时,无法从文件中读取属性列表,Info.plist 问题

[英]unable to read property list from file, Info.plist issue when I use Mapbox sdk in my app

我在我的 flutter 应用程序之一中遇到问题。 我正在使用 MapBox-SDK 插件,但是当我在 IOS 上测试应用程序时,它要求我将 Mapbox-sdk 更新到某个版本(我使用 pop install 命令进行了更新)。 现在,在我的 info.plist 文件中,我面临着新的错误。 我忘了备份我的旧 info.plist 文件。 无论如何,新的 info.plist 是:

<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

我在构建应用程序时面临的错误是:

错误:

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)

伙计们,我找不到解决方案。 无论如何请帮助我。 提前致谢。

错误error: unable to read property list from file: Info.plist通常是由于 plist 文件中缺少配置引起的。 正如前面在评论中提到的,您需要在NSLocationWhenInUseUsageDescription上设置一个值。 包的文档中解释了更多细节。

<key>NSLocationWhenInUseUsageDescription</key>
<string>[Your explanation here]</string>

我在新导入的 Flutter 项目中遇到了同样的问题。 经过一些调试,问题似乎是由损坏的 GoogleService-Info.plist 文件引起的,不知道为什么以及如何损坏。 因为我有新导入的和现有的项目。

要解决此问题,您可以按照以下步骤操作;

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

这对我有用,希望它也能解决你的问题。

就我而言,这是因为 Info.plist 文件格式不正确。 它与 XML 格式无关,因为当我试图根据 XML 规则查找该文件是否正确格式化时,没关系,但是当我尝试将 .plist 文件作为属性列表打开时,我意识到 ZA3B5A3EBD8A1E9EBF7D4 不能'不读它,所以我使用属性列表实用程序添加了我的密钥,而不是“代码视图”。

我通过在每个<key>...</key>之后包含<string/>解决了这个问题,如下所示:

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

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

<key>NSMicrophoneUsageDescription</key>
<string /> 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM