Flutter 插件问题(引入插件同时存在静态库与swift)

2019-10-23  本文已影响0人  猿姑凉

前提:Flutter 项目中引入使用多个插件,内含有swift与静态库时出现的一系列问题

问题一、swift插件缺少设置swift的版本号

Launching lib/main.dart on iPhone XS Max in debug mode...

CocoaPods' output:

↳

      Preparing

    Analyzing dependencies

    Inspecting targets to integrate

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

    Fetching external sources

    -> Fetching podspec for `Flutter` from `.symlinks/flutter/ios`

    -> Fetching podspec for `swift_plugin` from `.symlinks/plugins/swift_plugin/ios`

    Resolving dependencies of `Podfile`

    Comparing resolved specification to the sandbox manifest

      A Flutter

      A swift_plugin

    Downloading dependencies

    -> Installing Flutter (1.0.0)

    -> Installing swift_plugin (0.0.1)

      - Running pre install hooks

    [!] Unable to determine Swift version for the following pods:

    - `swift_plugin` 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.1/lib/cocoapods/installer/xcode/target_validator.rb:115:in `verify_swift_pods_swift_version'

    /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/installer/xcode/target_validator.rb:37:in `validate!'

    /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/installer.rb:459:in `validate_targets'

    /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/lib/cocoapods/installer.rb:138:in `install!'

    /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.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.1/lib/cocoapods/command.rb:52:in `run'

    /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.6.1/bin/pod:55:in `<top (required)>'

    /usr/local/bin/pod:22:in `load'

    /usr/local/bin/pod:22:in `<main>'

解决方案:在Xcode中打开项目Targets—>builds settings —>user-defined
在user-defined内添加一行:SWIFT_VERSION(版本号视当前版本号为准)


image.png

问题二、静态库
看到网上好多的解决方法是删除掉或者添加上Podfile中的use_frameworks!,实测与此无关,错误信息忘记截图啦😭,大体就是pod install 时出现无法install之类的信息
正解方法是找到相关错误插件内的podspec文件,添加s.static_framework = true


image.png
上一篇下一篇

猜你喜欢

热点阅读