目錄
出現(xiàn)場(chǎng)景
朋友的一個(gè)老項(xiàng)目,創(chuàng)建的時(shí)候用的是flutter 1.0版本。
現(xiàn)在讓我?guī)兔Ω膫€(gè)東西,我的Flutter是2.0,導(dǎo)入項(xiàng)目后,在ios上編譯時(shí)出現(xiàn)以下錯(cuò)誤
Upgrading contents.xcworkspacedata
Running pod install...
CocoaPods' output:
?[!] Invalid `Podfile` file: no implicit conversion of nil into String.# from /Users/ado/my/work/flutter/testdemo4/ios/Podfile:58# -------------------------------------------# unless File.exist?(copied_framework_path)> FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)# end# -------------------------------------------/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/podfile.rb:318:in `rescue in block in from_ruby'/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/podfile.rb:312:in `block in from_ruby'/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/podfile.rb:50:in `instance_eval'/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/podfile.rb:50:in `initialize'/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/podfile.rb:310:in `new'/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/podfile.rb:310:in `from_ruby'/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/podfile.rb:276:in `from_file'/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/config.rb:205:in `podfile'/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:160:in `verify_podfile_exists!'/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command/install.rb:46:in `run'/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:52:in `run'/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.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 12 Pro Max.
解決辦法
根據(jù)錯(cuò)誤提示,提示Podfile是無(wú)效文件,是Podfile中的內(nèi)容造成的錯(cuò)誤。
因?yàn)镻odfile是在flutter 1.0的環(huán)境下運(yùn)行生成的,估計(jì)是flutter1.0和2.0有一些配置上的不一樣,所以我們先刪除ios目錄中的Podfile和Podfile.lock,然后再重新運(yùn)行
flutter run
或者運(yùn)行
flutter run ios
這樣將會(huì)生成flutter 2.0的Podfile,編譯ios就不會(huì)報(bào)錯(cuò)了。
總結(jié)
以上是生活随笔為你收集整理的解决Invalid `Podfile` file: no implicit conversion of nil into String的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。