Luc*_*ini 69 ios firebase podspec flutter podfile
我已经将我的 flutter 包更新到最新版本,现在 IOS 不再工作了。
当我尝试更新 Pod 时,它显示此错误:
[!] CocoaPods could not find compatible versions for pod "Firebase/CoreOnly":
In Podfile:
cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`) was resolved to 0.0.1, which depends on
Firebase/Firestore (~> 6.0) was resolved to 6.0.0, which depends on
Firebase/CoreOnly (= 6.0.0)
cloud_functions (from `.symlinks/plugins/cloud_functions/ios`) was resolved to 0.0.1, which depends on
Firebase/Functions (~> 5.18) was resolved to 5.18.0, which depends on
Firebase/CoreOnly (= 5.18.0)
Run Code Online (Sandbox Code Playgroud)
这是我的 pubspec.yaml(与 Firebase 相关):
firebase_core: "^0.4.0"
firebase_auth: "^0.11.0"
firebase_analytics: "^3.0.0"
cloud_firestore: "^0.11.0+1"
cloud_functions: "^0.3.0"
firebase_storage: "^3.0.0"
firebase_messaging: "^5.0.1"
Run Code Online (Sandbox Code Playgroud)
我已经采取了各种步骤来尝试修复:
flutter clean
flutter build ios
pod install
pod update
pod repo update
pod install --repo-update
Run Code Online (Sandbox Code Playgroud)
我已经在 Podfile 和 Xcode 中将平台 :ios, '12.1' 设置为构建目标,但没有任何恢复。
这是我的 podfile:
# Uncomment this line to define a global platform for your project
platform :ios, '12.1'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def parse_KV_file(file, separator='=')
file_abs_path = File.expand_path(file)
if !File.exists? file_abs_path
return [];
end
pods_ary = []
skip_line_start_symbols = ["#", "/"]
File.foreach(file_abs_path) { |line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
plugin = line.split(pattern=separator)
if plugin.length == 2
podname = plugin[0].strip()
path = plugin[1].strip()
podpath = File.expand_path("#{path}", file_abs_path)
pods_ary.push({:name => podname, :path => podpath});
else
puts "Invalid plugin specification: #{line}"
end
}
return pods_ary
end
target 'Runner' do
use_frameworks!
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
# Flutter Pods
generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
if generated_xcode_build_settings.empty?
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
end
generated_xcode_build_settings.map { |p|
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
symlink = File.join('.symlinks', 'flutter')
File.symlink(File.dirname(p[:path]), symlink)
pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
end
}
# Plugin Pods
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.map { |p|
symlink = File.join('.symlinks', 'plugins', p[:name])
File.symlink(p[:path], symlink)
pod p[:name], :path => File.join(symlink, 'ios')
}
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
Run Code Online (Sandbox Code Playgroud)
Moh*_*bil 132
试试打电话 pod repo update
如果问题没有解决
删除根目录下的Podfile.lock,然后运行 pod install
Ari*_*ios 113
对于 M1 Mac 用户
ios/Pods/Local Podspecs项目中的目录json文件以找到所需的最高 iOS 版本。我的"ios": "10.0"在其中一些ios/ directoryPodfile文件# platform :ios, '9.0'并替换9.0为步骤 2 中的版本。- 例如 10.0。接下来是M1具体部分
跑步sudo arch -x86_64 gem install ffi
跑步arch -x86_64 pod repo update
运行arch -x86_64 pod install错误应该消失了
如果使用 Fluttercd - 返回根目录 - 打开 iOS Simulator 并运行flutter run
如果不起作用,您可能需要在第 1 步之前运行flutter pub add firebase_core将 firebase_core 添加到您的pubspec.yaml文件中
如果仍然不起作用,请尝试以下奖励步骤:
尝试直接从 Xcode 运行?flutter build ios首先在 Flutter 项目中运行-> 然后在 Xcode 中运行
仍然无法cd iOS运行rm -rf Pods/ Podfile.lock ; pod install
还是行不通 ?在 Spotlight 中搜索 Keychain Access -> 打开 -> 右键登录 -> 解锁(构建成功后将锁定)
小智 81
编辑 podfile 中的最低 ios 版本,然后运行 pod install。
更改platform :ios, '9.0'为platform :ios, '10.0'然后运行pod install为我修复了它。
mah*_*mnj 27
如果您使用的是 M1 mac。
通过运行删除 podfile.lock
arch -x86_64 rm -rf Podfile.lock
Run Code Online (Sandbox Code Playgroud)
然后通过运行更新 pod
arch -x86_64 pod install --repo-update
Run Code Online (Sandbox Code Playgroud)
Anu*_*pta 16
移动到文件夹ios:
\ncd ios\nRun Code Online (Sandbox Code Playgroud)\n\n\n方法一:
\n
打开终端并运行
\nsudo gem uninstall cocoapods\nsudo gem install cocoapods\nRun Code Online (Sandbox Code Playgroud)\n重新启动 IDE 或编辑器
\n\n\n方法二:
\n
注意:仅当方法 1不起作用时才尝试
\n现在是时候为M1 Mac安装 pod 了:
\n sudo arch -x86_64 gem install ffi\n arch -x86_64 pod repo update\n arch -x86_64 pod install\nRun Code Online (Sandbox Code Playgroud)\n现在99% 的安装错误应该消失了
\n现在只有 1% 的可能性您仍然会收到错误:
\n打开您的 ios Runner XCode 项目并按照图像说明进行操作。
\n更改目标架构中排除的架构
\nform i386 to arm64 i386 (Note: space is important)\nRun Code Online (Sandbox Code Playgroud)\n\n现在返回根目录并运行
\n flutter run\nRun Code Online (Sandbox Code Playgroud)\n\n\n另外,重新启动你的编辑器。
\n
\n\n预先说明:
\n
多次出现此错误并每次复制粘贴即可修复该错误。\n因此,我在此提供一种借助方法 2 实现此目的的更好方法:
\n复制下面的书面代码
\n#!/bin/bash\n\npwd\nsudo arch -x86_64 gem install ffi\narch -x86_64 pod repo update\narch -x86_64 pod install\nRun Code Online (Sandbox Code Playgroud)\n您需要在 IOS 文件夹中创建一个脚本文件,我们将其命名为pod_install.sh \n如果您再次遇到相同的问题,您只需运行一个命令即可。
\nsh pod_install.sh \nRun Code Online (Sandbox Code Playgroud)\n从你的 ios 文件夹中
\n现在输入你的mac的密码
\n现在喝茶 \xe2\x98\x95 时间
\n\n\n不要忘记重新启动编辑器。
\n
Adr*_*uri 14
执行 flutter clean
转到ios/文件夹,编辑Podfile并选择要启动的平台和版本。例如对于平台ios和版本12.0:
播客文件
# Uncomment this line to define a global platform for your project
platform :ios, '12.0'
Run Code Online (Sandbox Code Playgroud)
执行 pod update
执行pod install(下载依赖项可能需要几分钟时间)
执行 flutter run
Par*_*iya 10
您只需要更新 pod repo。您的 cocopods 存储库可能已过期
按照此命令更新您的 pod
flutter cleanpod repo update/ios/Pods/和/ios/Podfile.lockpod install=== 2023 年四月更新 ===
从 2023 年 4 月开始,您必须执行以下操作:
编辑iod/Podfile并编辑/修改或取消注释此行:
platform :ios, '11.0'
Run Code Online (Sandbox Code Playgroud)
保存文件并在 ios 目录中执行以下命令:
rm -rf Podfile.lock && pod install --repo-update
Run Code Online (Sandbox Code Playgroud)
2021 年 3 月
cloud_firestore: ^1.0.0
cd ios
rm Podfile.lock
pod repo update
Run Code Online (Sandbox Code Playgroud)
这个简单的解决方案对我有用(由 IDE 本身建议)
pod install --repo-update
Run Code Online (Sandbox Code Playgroud)
在终端 IOs 文件夹中运行命令
我在尝试将 Firebase Analytics 添加到我的项目时遇到了同样的问题。我一直在终端中运行 pod update,但在确保 pubspec.yaml 文件中的所有 flutter 包都是最新版本之前,我无法成功进入 FirebaseCore (6.0.0)。
1)我摆脱了导致错误的包。对我来说,它是 Firebase Analytics,因为我刚刚将它添加到我的项目中。
2) 我浏览了所有的 firebase 包,并确保我的 pubspec.yaml 中有最新版本。他们来了:
firebase_core: ^0.4.0
firebase_database: ^3.0.0
firebase_auth: ^0.11.0
firebase_storage: ^3.0.0
Run Code Online (Sandbox Code Playgroud)
3) 导航到 ios 文件夹并运行 pod update
4) 将 Firebase Analytics 包(或您有兴趣添加的任何内容)添加到 pubspec.yaml。
5)运行包获取
6) 在终端运行 pod install
| 归档时间: |
|
| 查看次数: |
44099 次 |
| 最近记录: |