搜索检查失败: undefined method ‘map’ for nil: NilClass in Flutter Application
Searching for inspections failed: undefined method `map' for nil: NilClass in Flutter Application
我正在开发基于简单聊天的 Flutter 应用程序。我正在使用 Firebase Auth、Firebase Messaging、Google 登录 和 云 Firestore。在 Android 中一切都运行顺利,但是当我在 iOS 环境中 运行 这个应用程序时,我遇到了一些问题,例如
" CocoaPods 的错误输出:
↳
搜索检查失败:nil 的未定义方法“map”:NilClass
异常:错误 运行ning pod install "
我也安装了一个cocoapod但是它不能正常工作,那个时候我也遇到了下面提到的另一个问题:-
" 不要忘记匿名化任何私人数据!
在 cocoapods/cocoapods 上寻找相关问题...
搜索检查失败:nil 的未定义方法“map”:NilClass“
我也使用了一些参考 Github 的解决方案,但仍然没有用。
============== 参考文献:-
================ 这是我的 Flutter Doctor 回复:-
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.6, on macOS 11.0.1 20B50 darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] Connected device (2 available)
• No issues found!
=================== 这是我的 pubspec.yaml:-
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
**google_sign_in: 4.4.3**
**firebase_auth: 0.15.4**
**cloud_firestore: ^0.13.5**
shared_preferences: ^0.5.6+3
**firebase_messaging: 6.0.13**
flutter_local_notifications:
http: ^0.12.2
==================== 这是我的 cocoapods 环境 还有 pod文件
堆栈
CocoaPods : 1.10.1
Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]
RubyGems : 3.1.4
Host : macOS 11.0.1 (20B50)
Xcode : 12.2 (12B45b)
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/
安装源
Executable Path: /usr/local/bin/pod
插件
cocoapods-deintegrate : 1.0.4
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-trunk : 1.5.0
cocoapods-try : 1.2.0
播客文件
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
在这个 podfile 中,我删除了 pods 因为出现了我上面提到的一些问题。
我正在使用 macOS Big Sur 版本 - 11.0.1 在 Android Studio 版本 4.1 中进行开发,并且在 iPad(第 6 代)版本 14.2.
中测试该应用程序
任何人都可以帮助我解决我做错了什么吗?所以我可以进一步解决 iOS.
中的这个错误
提前致谢。
看到评论区越来越大,我会在这跟进
我在驱动器 link 中看到 .xcodeproj
文件存在一些问题,您可以将它附加到驱动器吗?
在某些情况下,默认 pods 安装是错误的,需要手动编辑 .xcodeproj
文件以删除导致问题的部分。
在某些情况下,运行 gem update xcodeproj
解决了问题。
另外,如果你使用最新的CocoaPod版本就好了,因为Xcode版本和CocoaPod版本之间可能存在一些兼容性问题。
我正在开发基于简单聊天的 Flutter 应用程序。我正在使用 Firebase Auth、Firebase Messaging、Google 登录 和 云 Firestore。在 Android 中一切都运行顺利,但是当我在 iOS 环境中 运行 这个应用程序时,我遇到了一些问题,例如
" CocoaPods 的错误输出: ↳ 搜索检查失败:nil 的未定义方法“map”:NilClass 异常:错误 运行ning pod install "
我也安装了一个cocoapod但是它不能正常工作,那个时候我也遇到了下面提到的另一个问题:-
" 不要忘记匿名化任何私人数据! 在 cocoapods/cocoapods 上寻找相关问题... 搜索检查失败:nil 的未定义方法“map”:NilClass“
我也使用了一些参考 Github 的解决方案,但仍然没有用。 ============== 参考文献:-
================ 这是我的 Flutter Doctor 回复:-
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.6, on macOS 11.0.1 20B50 darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] Connected device (2 available)
• No issues found!
=================== 这是我的 pubspec.yaml:-
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
**google_sign_in: 4.4.3**
**firebase_auth: 0.15.4**
**cloud_firestore: ^0.13.5**
shared_preferences: ^0.5.6+3
**firebase_messaging: 6.0.13**
flutter_local_notifications:
http: ^0.12.2
==================== 这是我的 cocoapods 环境 还有 pod文件
堆栈
CocoaPods : 1.10.1
Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]
RubyGems : 3.1.4
Host : macOS 11.0.1 (20B50)
Xcode : 12.2 (12B45b)
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/
安装源
Executable Path: /usr/local/bin/pod
插件
cocoapods-deintegrate : 1.0.4
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-trunk : 1.5.0
cocoapods-try : 1.2.0
播客文件
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
在这个 podfile 中,我删除了 pods 因为出现了我上面提到的一些问题。
我正在使用 macOS Big Sur 版本 - 11.0.1 在 Android Studio 版本 4.1 中进行开发,并且在 iPad(第 6 代)版本 14.2.
中测试该应用程序任何人都可以帮助我解决我做错了什么吗?所以我可以进一步解决 iOS.
中的这个错误提前致谢。
看到评论区越来越大,我会在这跟进
我在驱动器 link 中看到 .xcodeproj
文件存在一些问题,您可以将它附加到驱动器吗?
在某些情况下,默认 pods 安装是错误的,需要手动编辑 .xcodeproj
文件以删除导致问题的部分。
在某些情况下,运行 gem update xcodeproj
解决了问题。
另外,如果你使用最新的CocoaPod版本就好了,因为Xcode版本和CocoaPod版本之间可能存在一些兼容性问题。