Flutter-geolocator: Swift 语言版本错误

创建于 2018-12-14  ·  7评论  ·  资料来源: Baseflow/flutter-geolocator

🐛 错误报告

构建错误

flutter  === BUILD TARGET permission_handler OF PROJECT Pods WITH CONFIGURATION Debug ===The “Swift Language Version” (SWIFT_VERSION) build setting must be set to asupported value for targets which use Swift. Supported values are: 3.0, 4.0, 4.2.This setting can be set in the build settings editor

版本: 1.x

平台:
:iphone: iOS

最有用的评论

我按照这里的建议将以下内容添加到我的ios/Podfile中。

target 'Runner' do
  use_frameworks!  # required
  ...
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '4.2'  # required
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

所有7条评论

我也无法在 iOS 设备上使用geolocator 2.1.1和以下flutter版本运行/构建:

Flutter 1.0.0 • channel beta • https://github.com/flutter/flutter.git
Framework • revision 5391447fae (5 weeks ago) • 2018-11-29 19:41:26 -0800
Engine • revision 7375a0f414
Tools • Dart 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

swift --version 打印

Apple Swift version 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1)
Target: x86_64-apple-darwin18.2.0

我在macOS 10.14.1上。

我创建了一个新的 Flutter 项目,将android.permission.ACCESS_FINE_LOCATION权限添加到AndroidManifest.xmlNSLocationWhenInUseUsageDescriptioninfo.plist ,并添加geolocator: ^2.1.1pubspec.yaml

我在flutter run上收到以下错误:

Running pod install...                                       0.9s
CocoaPods' output:
↳
      Preparing

    Analyzing dependencies

    Inspecting targets to integrate
      Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)

    Finding Podfile changes
      A geolocator
      A google_api_availability
      A permission_handler
      - Flutter
      - path_provider
      - shared_preferences

    Fetching external sources
    -> Fetching podspec for `Flutter` from `.symlinks/flutter/ios`
    -> Fetching podspec for `geolocator` from `.symlinks/plugins/geolocator/ios`
    -> Fetching podspec for `google_api_availability` from `.symlinks/plugins/google_api_availability/ios`
    -> Fetching podspec for `path_provider` from `.symlinks/plugins/path_provider/ios`
    -> Fetching podspec for `permission_handler` from `.symlinks/plugins/permission_handler/ios`
    -> Fetching podspec for `shared_preferences` from `.symlinks/plugins/shared_preferences/ios`

    Resolving dependencies of `Podfile`

    Comparing resolved specification to the sandbox manifest
      A Flutter
      A geolocator
      A google_api_availability
      A path_provider
      A permission_handler
      A shared_preferences

    Downloading dependencies

    -> Installing Flutter (1.0.0)

    -> Installing geolocator (2.1.1)

    -> Installing google_api_availability (1.0.4)

    -> Installing path_provider (0.0.1)

    -> Installing permission_handler (2.1.2)

    -> Installing shared_preferences (0.0.1)
      - Running pre install hooks
    [!] Unable to determine Swift version for the following pods:

     - `geolocator` does not specify a Swift version and none of the targets (`Runner`) integrating it have
     the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at
     least one of the targets that integrate this pod.\n- `google_api_availability` does not specify a Swift
     version and none of the targets (`Runner`) integrating it have the `SWIFT_VERSION` attribute set.
     Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that
     integrate this pod.\n- `permission_handler` does not specify a Swift version and none of the targets
     (`Runner`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the
     `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.

    /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0.beta.1/lib/cocoapods/installer/xcode/target_validator.rb:1
    15:in `verify_swift_pods_swift_version'
    /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0.beta.1/lib/cocoapods/installer/xcode/target_validator.rb:3
    7:in `validate!'
    /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0.beta.1/lib/cocoapods/installer.rb:443:in
    `validate_targets'
    /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0.beta.1/lib/cocoapods/installer.rb:124:in `install!'
    /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0.beta.1/lib/cocoapods/command/install.rb:48:in `run'
    /Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
    /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0.beta.1/lib/cocoapods/command.rb:52:in `run'
    /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.0.beta.1/bin/pod:55:in `<top (required)>'
    /usr/local/bin/pod:22:in `load'
    /usr/local/bin/pod:22:in `<main>'

Error output from CocoaPods:
↳

    [!] Automatically assigning platform `ios` with version `8.0` on target `Runner` because no platform was
    specified. Please specify a platform for this target in your Podfile. See
    `https://guides.cocoapods.org/syntax/podfile.html#platform`.

Error running pod install

我按照这里的建议将以下内容添加到我的ios/Podfile中。

target 'Runner' do
  use_frameworks!  # required
  ...
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '4.2'  # required
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end

似乎我还需要安装 Cocoapod 版本1.5.3 。 不是最新的1.6测试版。

是的,我也是

我找到了解决方案,
geolocator和onesignal同时使用,有错误,
所以不使用地理定位器,只使用位置

我在 Cocoapod 1.6 版上。 有人可以告诉我如何使用 brew 降级到 Cocoapod 版本 1.5.3 吗?

我找不到解决办法。

我在 Cocoapod 1.6 版上。 有人可以告诉我如何使用 brew 降级到 Cocoapod 版本 1.5.3 吗?

我找不到解决办法。

我在 StackOverflow 中发现这个答案对降级很有用: https :

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

BigWillieStyle picture BigWillieStyle  ·  6评论

devalp-pro picture devalp-pro  ·  3评论

lqmminh picture lqmminh  ·  6评论

hectorAguero picture hectorAguero  ·  5评论

DineshKachhot picture DineshKachhot  ·  7评论