gpt4 book ai didi

ios - Flutter iOS 构建在运行 pod 安装时失败

转载 作者:IT王子 更新时间:2023-10-29 06:53:44 25 4
gpt4 key购买 nike

我正在尝试制作一个 flutter 插件,所以我按照 https://flutter.dev/docs/development/packages-and-plugins/developing-packages 上提供的步骤创建了一个插件.当我尝试运行 ios 示例时出现错误。下面是我在运行 ios 示例应用程序时得到的日志。

谁能帮我解决这个问题?

Running pod install...
CocoaPods' output:
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 `flutter_plugin` from `.symlinks/plugins/flutter_plugin/ios`

Resolving dependencies of `Podfile`

Comparing resolved specification to the sandbox manifest
A Flutter
A flutter_plugin

Downloading dependencies

-> Installing Flutter (1.0.0)

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

- `flutter_plugin` does not specify a Swift version and none of the targets (`Runner`) integrating it has 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>'

Error output from CocoaPods:
[33mWARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
Consider adding the following to ~/.profile:
Error running pod install

最佳答案

找到问题了。当我们在终端上通过命令创建一个插件时,它会创建一个插件,默认使用 Java for Android 和 Objective-C for iOS。可以使用命令将其更改为适用于 Android 的 Kotlin 和适用于 iOS 的 Swift,但它只会在根文件夹中添加对 android/ios/ 的支持。这不会更改 example/ 目录中的示例代码。提供的示例仍然是 Java for Android 和 Objective-C for iOS。然后我从 Android Studio 创建了一个插件,我通过选中选项“包括对 ios 代码的 Swift 支持”创建了对 iOS 的 Swift 支持,它创建了一个使用 swift 而不是 Objective-C 的示例。那么问题就解决了。

关于ios - Flutter iOS 构建在运行 pod 安装时失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54912188/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com