在iOS中运行Flutter应用程序时出错

icnyk63a  于 2023-04-22  发布在  Flutter
关注(0)|答案(7)|浏览(250)
Launching lib/main.dart on iPhone 12 Pro Max in debug mode...

运行pod install... CocoaPods的输出:CDN:trunk相对路径:CocoaPods-version.yml存在!返回本地,因为只在repo update中进行检查
CocoaPods的错误输出:警告:CocoaPods要求您的终端使用UTF-8编码。请考虑在~/.profile中添加以下内容:

export LANG=en_US.UTF-8
    
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/unicode_normalize/normalize.rb:141:in `normalize': Unicode Normalization not appropriate for ASCII-8BIT (Encoding::CompatibilityError)
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/config.rb:166:in `unicode_normalize'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/config.rb:166:in `installation_root'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/config.rb:226:in `podfile_path'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/user_interface/error_report.rb:105:in `markdown_podfile'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/user_interface/error_report.rb:30:in `report'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/command.rb:66:in `report_error'
    from /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:396:in `handle_exception'
    from /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:337:in `rescue in run'
    from /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:324:in `run'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/command.rb:52:in `run'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/bin/pod:55:in `<top (required)>'
    from /usr/local/bin/pod:23:in `load'
    from /usr/local/bin/pod:23:in `<main>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/unicode_normalize/normalize.rb:141:in `normalize': Unicode Normalization not appropriate for ASCII-8BIT (Encoding::CompatibilityError)
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/config.rb:166:in `unicode_normalize'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/config.rb:166:in `installation_root'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/config.rb:226:in `podfile_path'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/config.rb:205:in `podfile'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/command.rb:160:in `verify_podfile_exists!'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/command/install.rb:46:in `run'
    from /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/command.rb:52:in `run'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/bin/pod:55:in `<top (required)>'
    from /usr/local/bin/pod:23:in `load'
    from /usr/local/bin/pod:23:in `<main>'

在iPhone 12 Pro Max上启动应用程序时出错。

wz8daaqr

wz8daaqr1#

这似乎是Cocoapodsv1.11.0中的一个bug/不兼容问题
为了解决这个问题,我遵循了以下步骤,它就像一个魅力:https://stackoverflow.com/a/69076515/16881741
简单地说,请执行以下步骤:
1.在您的终端,在ios文件夹类型
gem list --local | grep cocoapods
1.注意上一个命令的输出是什么。它看起来像这样(请忽略各个条目附近的版本,这是我的输出,我已经使用版本1.10.1):
cocoapods (1.10.1) cocoapods-core (1.10.1) cocoapods-deintegrate (1.0.5) cocoapods-downloader (1.5.1) cocoapods-plugins (1.0.0) cocoapods-search (1.0.1) cocoapods-trunk (1.6.0) cocoapods-try (1.2.0)
1.一个接一个地启动sudo gem uninstall X命令,将“X”替换为cocoapods组件的名称,而不是版本。最后,您应该获得以下内容:
sudo gem uninstall cocoapods sudo gem uninstall cocoapods-core sudo gem uninstall cocoapods-deintegrate sudo gem uninstall cocoapods-downloader sudo gem uninstall cocoapods-plugins sudo gem uninstall cocoapods-search sudo gem uninstall cocoapods-trunk sudo gem uninstall cocoapods-try
确保已包括第1点中列出的所有组件,以避免脏状态
1.使用命令sudo gem install cocoapods -v 1.10.1获取正确的版本。
所有的荣誉埃斯特班洛佩斯,作者的答案,我链接在顶部。

cyvaqqii

cyvaqqii2#

这个问题出现在Cocoapods 1.11.0中,正如许多人已经注意到的那样,回滚到1.10.2解决了这个问题。但最初的问题来自终端中设置的错误区域设置。它必须是基于UTF-8的区域设置。
here中的第二个答案为我解决了这个问题。
如前所述,只管跑

export LC_ALL=en_US.UTF-8

在你的终端中,错误应该会消失。考虑把它添加到你的.zshrc文件中,这样它就会在每个会话中自动发生。

wbgh16ku

wbgh16ku3#

这对我很有效:

flutter clean,
delete /iOS/Pods,
delete /iOS/Podfile.lock,
flutter build ios.

我的Mac版本信息:

CocoaPods : 1.11.0
        Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]
    RubyGems : 3.0.3
        Host : macOS 11.5.2 (20G95)
       Xcode : 12.5.1 (12E507)
         Git : git version 2.23.0
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/
polhcujo

polhcujo4#

在VCode上运行了相同的项目,并且成功运行,我猜问题出在我的Android Studio上。

xxhby3vn

xxhby3vn5#

升级Ruby是解决此问题的另一种方法。

lxkprmvk

lxkprmvk6#

使用默认的terminal尝试pod install

bqjvbblv

bqjvbblv7#

open terminal export LC_ALL=en_US.UTF-8这将解决您的问题。

相关问题