【问题标题】:Conflict between location and url_launcher pluginlocation 和 url_launcher 插件之间的冲突
【发布时间】:2017-07-12 06:14:27
【问题描述】:

我正在开发一个应用程序,该应用程序可以在用户的​​位置周围找到兴趣点。为了获取用户的位置,我使用了 location 插件,它工作得非常好。
我想实现的下一件事是打开默认映射应用程序以将用户导航到 POI 的按钮。我使用url_launcher 插件和geo:android 的url 方案和maps:iOS 方案。
两个插件相互独立,按预期工作。一旦我的项目中有两个插件,问题就开始了。使用flutter create 的默认设置会出现以下错误:

Launching lib/main.dart on iPhone 6 in debug mode...
Running pod install...
CocoaPods' output:
↳
  Preparing

Analyzing dependencies

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

Finding Podfile changes
  - Flutter
  - location
  - url_launcher

Fetching external sources
-> Fetching podspec for `Flutter` from `/Users/rainerwittmann/Flutter/flutter/bin/cache/artifacts/engine/ios`
-> Fetching podspec for `location` from `/Users/rainerwittmann/.pub-cache/hosted/pub.dartlang.org/location-1.0.2/ios`
-> Fetching podspec for `url_launcher` from `/Users/rainerwittmann/.pub-cache/hosted/pub.dartlang.org/url_launcher-0.4.2+1/ios`

Resolving dependencies of `Podfile`

Comparing resolved specification to the sandbox manifest
  - Flutter
  - location
  - url_launcher

Downloading dependencies

-> Using Flutter (1.0.0)

-> Using location (0.0.1)

-> Using url_launcher (0.0.1)
  - Running pre install hooks
[!] Pods written in Swift can only be integrated as frameworks; add `use_frameworks!` to your Podfile or target to opt into using it. The Swift Pod being used is: location

/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer.rb:448:in `block (2 levels) in verify_framework_usage'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer.rb:443:in `each'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer.rb:443:in `block in verify_framework_usage'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer.rb:440:in `each'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer.rb:440:in `verify_framework_usage'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer.rb:114:in `install!'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/command/install.rb:37:in `run'
/Library/Ruby/Gems/2.0.0/gems/claide-1.0.1/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/command.rb:50:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
Error running pod install
Error launching application on iPhone 6.

到目前为止一切顺利。添加 use_frameworks!到我的 podfile,如错误消息所示,导致另一个错误:

Launching lib/main.dart on iPhone 6 in debug mode...
Running pod install...
Running Xcode build...
Failed to build iOS app
Error output from Xcode build:
↳
** CLEAN FAILED **


The following build commands failed:
    Check dependencies
(1 failure)
** BUILD FAILED **


The following build commands failed:
    Check dependencies
(1 failure)
Xcode's output:
↳
Build settings from command line:
    ARCHS = x86_64
    BUILD_DIR = /Users/rainerwittmann/Flutter/zapfsuche/build/ios
    ONLY_ACTIVE_ARCH = YES
    SDKROOT = iphonesimulator10.3

=== CLEAN TARGET location OF PROJECT Pods WITH CONFIGURATION Release ===

Check dependencies
“Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.

=== CLEAN TARGET url_launcher OF PROJECT Pods WITH CONFIGURATION Release ===
Check dependencies

=== BUILD TARGET url_launcher OF PROJECT Pods WITH CONFIGURATION Release ===

Check dependencies

=== BUILD TARGET location OF PROJECT Pods WITH CONFIGURATION Release ===

Check dependencies
“Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.

Could not build the application for the simulator.
Error launching application on iPhone 6.

不幸的是,我不知道如何从这里开始。有人可以帮我解决这个问题吗?

注意
此问题仅存在于 iOS 上。这两个插件都像 android 上的魅力一样工作。

【问题讨论】:

    标签: ios plugins dart flutter


    【解决方案1】:

    Swift 插件需要 use_frameworks!并且还没有完全支持。

    我是currently working。感谢您的耐心等待!

    【讨论】:

    • 所以我不能同时使用这两个插件?有解决办法吗?
    • 在该错误中讨论了一种解决方法(pre_install 挂钩)。如果您手动将标题复制到适当的位置,则它可以工作。我正在努力自动执行此操作。
    【解决方案2】:

    编辑 Pod 文件

    在 "target 'Runner' do" 行号 ~35 之后添加/取消注释

    use_frameworks!
    

    然后在行号~67之后添加这一行

    config.build_settings['SWIFT_VERSION'] = '4.0'
    

    例子:

    target 'Runner' do
      ** use_frameworks!  **
    ........ ......
    
    post_install do |installer|
          installer.pods_project.targets.each do |target|
            target.build_configurations.each do |config|
              config.build_settings['ENABLE_BITCODE'] = 'NO'
              ** config.build_settings['SWIFT_VERSION'] = '4.0' **
            end
          end
        end
    

    删除您的 Podfile.lock 并尝试。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-27
      • 1970-01-01
      • 2013-12-20
      • 1970-01-01
      • 2011-03-10
      • 1970-01-01
      • 1970-01-01
      • 2022-07-07
      相关资源
      最近更新 更多