Плагин Image_picker для флаттера вызывает ошибку сборки при работе на iOS - PullRequest
2 голосов
/ 20 января 2020

Я получаю эту ошибку при запуске приложения флаттера на симуляторе iOS.

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

Это мой файл pubspe c .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

Это моя информация. Плист файл. Я добавил 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 вызывает ошибку, но я не знаю, почему. Пожалуйста, помогите мне, спасибо.

1 Ответ

1 голос
/ 02 апреля 2020

Похоже, основной ошибкой является то, что вы не настроили раздел «Подписание и возможности проекта» своего приложения, поэтому приложение не может быть подписано при сборке.

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

Чтобы исправить это, откройте iOS проект для приложения в xcode, и выберите цель бегуна. Вы должны увидеть раздел настроек Signing & Capabilities , где вы можете управлять подписью для приложения, и выбрать команду для проекта . Также будет кнопка для создания команды, если у вас ее еще нет.

Что касается ошибок архитектуры:

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 и выше в разделе Общие должны исправить это, и в целом я бы рекомендовал установить минимальную цель iOS для новых приложений флаттера, чтобы помочь с совместимостью пакетов, если у вас нет причин поддерживать iOS 8.0.

И хотя это не относится к вашей проблеме, но к потенциальной проблеме в будущем, я бы изменил описание <false/> на <string> в NSLocationWhenInUseUsageDescription , поскольку это то, что там ожидается:

<key>NSLocationWhenInUseUsageDescription</key>
<string>Allow access to your device's location</string>
...