flutter 的 Image_picker 插件在 iOS 上运行时会导致构建错误

2024-06-24

在 iOS 模拟器上运行 flutter 应用程序时出现此错误。

/Users/sirapol/Desktop/FirstCareFrontEnd/care_now_frontend_v1/build/ios/Debug-iphonesimulator/shared_preferences/shared_prefe
    rences.framework: resource fork, Finder information, or similar detritus not allowed
    Command CodeSign failed with a nonzero exit code
    note: Using new build system
    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')

这是我的 pubspec.yaml 文件

name: care_now_frontend_v1
description: A new Flutter project.

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  sdk: ">=2.1.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2
  provider: ^3.0.0
  http: ^0.12.0+4
  image_picker: ^0.6.3+1
  path_provider: ^1.1.0
  shared_preferences: ^0.5.6
  # image_picker: ^0.6.1+4
  # image_picker_modern: ^0.4.12+2
  firebase_storage: ^3.1.1



dev_dependencies:
  flutter_test:
    sdk: flutter


# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:
  assets:
     - assets/images/

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  # assets:
  #  - images/a_dot_burr.jpeg
  #  - images/a_dot_ham.jpeg

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

这是我的 info.plist 文件。我已经添加了 NSPhotoLibraryUsageDescription,如 image_picker 文档中所述。

<?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>
    <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>care_now_frontend_v1</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>UIViewControllerBasedStatusBarAppearance</key>
    <string>UIViewController</string>
    <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>NSLocationWhenInUseUsageDescription</key>
  <false/>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>${PRODUCT_NAME} Library Usage</string>
    <key>NSCameraUsageDescription</key>
    <string>${PRODUCT_NAME} Camera Usage</string>
    <key>NSMicrophoneUsageDescription</key>
    <string>${PRODUCT_NAME} Microphone Usage</string>
</dict>
</plist>

我怀疑 info.plist 文件导致了错误,但我不知道为什么。请帮助我,谢谢。


看来主要的失败是您尚未配置应用程序的项目签名和功能部分,因此应用程序在构建时无法进行签名。

/Users/sirapol/Desktop/FirstCareFrontEnd/care_now_frontend_v1/build/ios/Debug-iphonesimulator/shared_preferences/shared_prefe
    rences.framework: resource fork, Finder information, or similar detritus not allowed
    Command CodeSign failed with a nonzero exit code
    note: Using new build system
    note: Planning build
    note: Constructing build description
    ...
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')

要解决此问题,请在 xcode 中打开应用程序的 iOS 项目,然后选择运行器目标。你应该看到一个签名和能力设置部分,您可以在其中管理应用程序的签名,以及为该项目选择一个团队。如果您还没有团队,还会有一个用于创建团队的按钮。

至于架构错误:

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')

设置部署目标为 iOS 9.0以及上面的General部分应该解决这个问题,一般来说,我建议将其作为新 flutter 应用程序的最低 iOS 目标,以帮助提高包兼容性,除非您有理由支持 iOS 8.0。

虽然与您的问题无关,但与未来的潜在问题有关,但我会更改<false/> to a <string>下的描述NSLocationWhenInUseUsageDescription因为这就是预期的结果:

<key>NSLocationWhenInUseUsageDescription</key>
<string>Allow access to your device's location</string>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

flutter 的 Image_picker 插件在 iOS 上运行时会导致构建错误 的相关文章

随机推荐

  • 从非托管代码传递指针

    我有一个导入 C dll 的 C 项目 该 dll 有以下功能 int primary read serial int handle int return code int serial int length 我想访问串行参数 我实际上已经
  • C# 设置 FontDialog 仅显示 TrueType 字体

    几乎每个论坛都有人问过这个问题 包括here https stackoverflow com questions 5027001 only truetype fonts are supported this is not a truetyp
  • 将具有混合内容的命名列表转换为数据框

    是否有更好更好的方法将具有混合内容的命名列表转换为数据框架 工作示例 my list lt list a 1 0 b foo c TRUE my df lt data frame key names my list stringsAsFac
  • Matplotlib 中经常使用的不寻常的 Python 语法元素

    一个附带条件 我的问题的核心语法元素是 Python 语言 然而 这个元素经常出现在 Matplotlib 库中 这是我见过它的唯一上下文 因此 我不确定这是一般的 Python 语法问题还是特定于库的问题 我所知道的是 我找不到任何要点
  • 在gnuplot中绘制两点之间的线

    我有一个 csv 文件 其格式如下 有四列 作为MWE xcoord1 ycoord1 xcoord2 ycoord2 0 1 0 2 0 4 0 3 0 5 0 3 0 7 0 5 我想从每个xcoord1 ycoord1 to xcoo
  • 我可以将 Entity Framework 6 与 Visual Studio 2010 一起使用吗?

    我们的开发团队 和构建服务器 成功地将 Visual Studio 2010 和 Visual Studio 2012 混合用于我们的应用程序 然而 自从从 EF5 升级到 EF6 后 我们似乎不再能够使用 VS2010 进行构建 具体来说
  • 如何修改 PHP/Jquery/Ajax 脚本以拥有多个表单字段

    我有一个 php Ajax Jquery 脚本 它将表单字段插入 MySQL 并更新页面 当您点击提交时无需刷新 我希望脚本提交四个表单字段 而不是仅一个 我已经更新了数据库表add delete record还有 3 个附加字段 余额 帐
  • Javascript 从多选选项框中获取值

    这让我发疯 这一定是我所忽视的简单而愚蠢的事情 我的表单中有一个多重选择框 我只是想获取所选的值 在我的循环中 如果我使用警报那么我就没有问题 一旦尝试连接这些值 我就会收到错误 SelBranch selected 为空或不是对象
  • 我可以在没有私钥的情况下将多个证书合并为一个吗?

    我需要在许多设备中拥有最新的证书信任存储 因此我希望能够将它们合并到证书中 然后我可以只推送该一个文件 我只想捆绑多个 CA 的公钥 但我不想添加私有文件 因为我想要将证书推送到我的所有设备 我认为这个功能被称为链 但 openssl 不会
  • 在seaborn kdeplot中设置置信度

    我对seaborn完全陌生 所以如果这是一个简单的问题 我深表歉意 但我在文档中找不到关于如何在kdeplot中控制n levels绘制的级别的描述 这是一个例子 import seaborn as sns import numpy as
  • 如何设置从自定义文件类型到程序的文件关联

    假设我创建了一个自定义文件 它实际上对应于我的程序可以读取的内容 称为 Bacon dek 我可以正常地从我的程序访问它 修改它等 只有少数问题仍然存在 也以相对正确的速度修复它们 现在 我想做的 并在完成后尝试快速修复 实际上是从 Win
  • 获取API错误处理

    我想显示来自 API 的错误消息 问题是如果我检查 我无法到达该错误response ok 它返回 Fetch 错误 而不是来自 API 的错误 如果我不使用if response ok 它从 API 返回错误 但调度成功操作 这是登录操作
  • 您可以在 clojure defrecord 中指定方法的返回类型吗?

    我已经创建了一个应用程序信息接口和一个类 但是当我查看生成的类时 所有方法的返回类型都是 Object 我可以将返回类型更改为 String 吗 文档说类型提示可以使用 defrecord 但没有给出示例 我能找到的唯一示例是类型提示字段和
  • WinSCP:校验和计算(不支持该操作。)

    我在 C WinForms 应用程序中使用 WinSCP NET 程序集 并且希望将远程目录与本地目录同步 这与 WinSCP 配合得很好 但在同步开始之前 我想检查远程和区域设置控制器是否完全不同 为此 我想使用CalculateFile
  • 当 Axios 中的 responseType 为 blob 和 VueJs 时,如何读取 http 错误? [复制]

    这个问题在这里已经有答案了 我在 VueJS 应用程序中使用 Blob responseType 和 Axios 从服务器下载文档 当响应代码为 200 时 它工作正常并下载文件 但是当出现任何 http 错误时 我在捕获错误时无法读取状态
  • Angular 10 在从不同工作区渲染组件时使用库时无法读取 null 属性“bindingStartIndex”

    我创建了一个位于我的应用程序工作区之外的 Angular Library 结果是我有两个不同的工作空间 我的第一个方法是建立我的图书馆和链接 dist与我的应用程序的文件夹 这对于 ngserve 来说效果不太好 但无论如何我在渲染我的库组
  • 如何声明字符串数组(多行)

    为什么 dlls Count返回单个元素 我尝试这样声明我的字符串数组 basePath Split Path MyInvocation MyCommand Path dlls basePath bin debug dll1 dll bas
  • Ionic2 + Angular2 - 带有离子图标星的动态速率值

    我正在尝试构建一个从 0 到 5 颗星的简单动态速率 及其中间值 如 x 5 示例 4 5 该速率从 javascript 接收值 我用 ngFor 寻找一些东西 但我不明白它是如何工作的 有人可以解释 帮助我吗 如果有帮助的话 对于 io
  • iPhone/iPod 模拟器和设备之间的差异

    自从我开始 iPhone iPod 开发以来 我发现模拟器和真实设备的反应之间存在一些差异 也许我会遇到一些其他差异 我也必须弄清楚 也许其他人还没有在这里遇到这些问题 并且可以从知识中受益 也许你知道一些你本来会遇到的问题 差异很高兴在您
  • flutter 的 Image_picker 插件在 iOS 上运行时会导致构建错误

    在 iOS 模拟器上运行 flutter 应用程序时出现此错误 Users sirapol Desktop FirstCareFrontEnd care now frontend v1 build ios Debug iphonesimul