前言
最近在运行flutter项目iOS环境时,遇到了以下3个错误,研究了好久,终于找到了解决方案,Mark一下
- pod install error
- NoMethodError - undefined method `size’ for nil:NilClass
- NoMethodError - undefined method `each’ for nil:NilClass
问题截图
[!] Oh no, an error occurred.
Search for existing GitHub issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=undefined+method+%60size%27+for+nil%3ANilClass&type=Issues
If none exists, create a ticket, with the template displayed above, on:
https://github.com/CocoaPods/CocoaPods/issues/new
Be sure to first read the contributing guide for details on how to properly submit a ticket:
https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md
Don't forget to anonymize any private data!
Looking for related issues on cocoapods/cocoapods...
- pod install error
https://github.com/CocoaPods/CocoaPods/issues/9453 [open] [1 comment]
3 days ago
- NoMethodError - undefined method `size' for nil:NilClass
https://github.com/CocoaPods/CocoaPods/issues/9295 [closed] [2 comments]
04 Nov 2019
- NoMethodError - undefined method `each' for nil:NilClass
https://github.com/CocoaPods/CocoaPods/issues/9239 [closed] [3 comments]
6 weeks ago
and 2 more at:
https://github.com/cocoapods/cocoapods/search?q=undefined%20method%20%60size%27%20for%20nil&type=Issues&utf8=✓
[!] Automatically assigning platform `iOS` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
问题的相关连接:
解决办法
在flutter项目里打开 Terminal
依次执行:
flutter clean
rm -Rf ios/Pods
rm -Rf ios/.symlinks
rm -Rf ios/Flutter/Flutter.framework
rm -Rf ios/Flutter/Flutter.podspec
flutter build iOS
解决完毕,希望对有需要的同学有所帮助~~