请在Podfile中为此目标指定一个平台?

Gow*_*n M 16 ios firebase swift google-cloud-firestore

我想配置Firebase Firestore.我按照所有步骤,但最后一步我得到了错误链接,我提到.

执行此pod后安装以下错误我得到了错误

[!] 因为没有指定平台ios,所以11.4在目标上自动分配平台版本testing_gowtham.请在Podfile中为此目标指定一个平台.见 https://guides.cocoapods.org/syntax/podfile.html#platform.

我的PodFile:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'testing_gowtham' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!


  # Pods for testing_gowtham

  target 'testing_gowthamTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'testing_gowthamUITests' do
    inherit! :search_paths
    # Pods for testing
  end

    pod 'Firebase/Core'
    pod 'Firebase/Firestore'
end
Run Code Online (Sandbox Code Playgroud)

我看到了这个https://guides.cocoapods.org/syntax/podfile.html#platform,但我没有找到需要更改的行.

如何解决这个问题?

aBi*_*l17 30

用下面的文本替换整个pod文件,然后检查.

# Uncomment the next line to define a global platform for your project

# platform :ios, '9.0'

target 'testing_gowtham' do

use_frameworks!


pod 'Firebase/Core'
pod 'Firebase/Firestore'
end
Run Code Online (Sandbox Code Playgroud)

(或)解决方案2

platform :ios, '9.0'工作......我只是删除#

  • 感谢您的快速回复...只是我需要删除这一行 **# platform :ios, '9.0'** 我是对的 (2认同)
  • 不,让我改变我的答案 (2认同)

小智 14

# Uncomment the next line to define a global platform for your project
 platform :ios, '9.0'

target 'testing_gowtham' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for testing_gowtham
 pod 'Firebase/Core'
 pod 'Firebase/Firestore'

end
Run Code Online (Sandbox Code Playgroud)


Tas*_*hin 14

在你的 Podfile -> 取消注释 platform 并设置 ios : 10.0

    platform :ios, '10.0'
Run Code Online (Sandbox Code Playgroud)

这会起作用。


Par*_*iya 9

有三种方法可以修复它

  1. 突破性壮举:将端口转发到 firebase-ios-sdk v7.3.0。
  1. 转到ios/Podfile 项目中的文件 ,在那里找到该行

    # platform :ios, '9.0' // and uncomment it. 
    
    Run Code Online (Sandbox Code Playgroud)

    取消注释您的 Podfile 后看起来像这样

    # Uncomment the next line to define a global platform for your project
     platform :ios, '9.0'
    
    target 'testing_gowtham' do
    # Comment the next line if you're not using Swift and don't want to use 
     dynamic frameworks
     use_frameworks!
    
    # Pods for testing_gowtham
     pod 'Firebase/Core'
     pod 'Firebase/Firestore'
    end
    
    Run Code Online (Sandbox Code Playgroud)

    之后删除ios/Podfile.lock文件并运行pod install

  2. 在终端中按照以下命令解决问题:

    gem uninstall cocoapods
    gem install cocoapods
    rm Podfile.lock
    pod setup
    pod install
    
    Run Code Online (Sandbox Code Playgroud)

如果您rvm以 root 用户sudo身份安装,那么您必须安装任何东西。喜欢sudo gem uninstall cocoapods


Sha*_*tim 7

更新了 2022 年的答案。 这是因为您的最低部署目标低于 iOS 10。根据Firebase ios 设置文档,您的项目必须面向 ios 平台版本 iOS 10 或更高版本:

  1. 命令$ flutter clean

  2. 打开目录中的Podfileios/Podfile

  3. 取消注释该行platform :ios, '9.0' and change 9.0 to 10.0

    # Uncomment this line to define a global platform for your project
      platform :ios, '10.0'
    
    Run Code Online (Sandbox Code Playgroud)
  4. 保存文件

  5. $ flutter run


小智 6

如果安装时出现上述错误pod 'PusherSwift'pod 'AlamofireImage'需要将#符号从

# platform :ios, '9.0'.
Run Code Online (Sandbox Code Playgroud)

然后在终端中写入命令pod install

当您再次运行该项目时,错误将根据'pusher swift'.you have to click unblock option 出现。那么问题就顺利解决了。


Hou*_*ser 6

删除Podfile.lock文件并运行pod install.

我通过更改目标 iOS 版本并在更多设备上开发应用程序来解决这个问题。

为我工作,但要小心 - 它将替换您正在使用的所有库的锁定(缓存)版本。检查自己是否完全理解Podfile.lock文件的作用 --> https://guides.cocoapods.org/using/using-cocoapods.html


Kro*_*sys 5

对于Apple Silicon M1 芯片

  1. 编辑 ./ios/Podfile platform :ios, '11.4'或任何版本
  2. 安装菲力arch -x86_64 sudo gem install ffi
  3. 重新安装 Pod
flutter clean
cd ios
arch -x86_64 pod install
cd ..
flutter run
Run Code Online (Sandbox Code Playgroud)