【问题标题】:Please specify a platform for this target in your Podfile?请在您的 Podfile 中为此目标指定一个平台?
【发布时间】:2019-02-02 02:04:09
【问题描述】:

我想配置 Firebase Firestore。我遵循了所有步骤,但在最后一步,我得到了下面我提到的错误链接。

执行此 pod install 命令后出现以下错误

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

我的播客文件:

# 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

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

如何解决这个问题?

【问题讨论】:

  • 查看第一行的注释,它说取消注释第二行以便设置平台。
  • 我删除了第二行仍然是同样的错误先生
  • 不要删除,取消注释
  • // # platform :ios, '9.0' i uncomment like this..但还是同样的错误,先生
  • 平台:ios,'9.0'

标签: ios swift firebase google-cloud-firestore podfile


【解决方案1】:

用下面的文本替换你的整个 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

(或)解决方案2

platform :ios, '9.0' 正在工作...我只是删除了 # 这个

【讨论】:

  • 感谢您的快速响应...只是我需要删除这一行 # platform :ios, '9.0' 我是对的
  • 不,让我改一下答案
  • 谢谢兄弟..我删除了同样的错误..你能给出确切的答案我应该改变什么..
  • 谢谢,我会检查一下,请稍等
  • aBilal17 有什么问题,先生还有其他想法吗
【解决方案2】:
# 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

【讨论】:

    【解决方案3】:

    有三种方法可以解决它

    1. 突破性壮举:将端口转发到 firebase-ios-sdk v7.3.0。
    • 由于此次 SDK 升级,iOS 10 现在是 FlutterFire 支持的最低版本。请更新您的构建目标版本。

      解决方案

      转到项目中的文件ios/Podfile,然后取消注释

      # platform :ios, '9.0'
      

      然后将版本改为10

      platform :ios, '10.0'
      
    1. 转到您项目中的文件ios/Podfile,找到该行

      # platform :ios, '9.0' // and uncomment it. 
      

      取消注释您的 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
      

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

    2. 按照终端中的这些命令来解决问题:

      gem uninstall cocoapods
      gem install cocoapods
      rm Podfile.lock
      pod setup
      pod install
      

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

    【讨论】:

      【解决方案4】:

      如果在安装pod 'PusherSwift'pod 'AlamofireImage' 时出现上述错误,则必须从中删除# 符号

      # platform :ios, '9.0'.
      

      然后在您的终端中编写命令pod install

      当您再次运行项目时,将根据'pusher swift'出现错误。您必须单击取消阻止选项。那么问题就成功解决了。

      【讨论】:

      • 伟大的 kurupareshan .!!你节省了我的时间。
      【解决方案5】:

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

      我通过更改目标 iOS 版本并在更多设备上开发应用程序时遇到了这个问题。

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

      【讨论】:

        【解决方案6】:

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

            platform :ios, '10.0'
        

        这会起作用。

        【讨论】:

          【解决方案7】:

          最简单的答案是取消注释 Podfile 的第二行并将 iOS 版本更改为 10 像这样。请注意,接下来的 Xcode 构建将比平时花费更多时间。不知道为什么……

          platform :ios, '10.0'
          

          【讨论】:

          • 因为它再次运行 pod install
          【解决方案8】:

          platform :ios, '9.0' is working...我只是删除了#这个

          【讨论】:

            【解决方案9】:

            在 Flutter 项目中,我也遇到过这个问题。通过将颤振和可可豆荚更新到最新版本来修复。

            解决方案:-

            • 扑干净
            • rm -Rf ios/Pods
            • rm -Rf ios/.symlinks
            • rm -Rf ios/Flutter/Flutter.framework
            • rm -Rf ios/Flutter/Flutter.podspec
            • cd ios
            • pod 安装
            • cd ..
            • flutter build ios

            【讨论】:

              【解决方案10】:

              就我而言,这是因为我有 6 个月没有运行的旧项目。

              我刚刚使用这个命令创建了一个新的 Flutter 项目 flutter create -i swift -a kotlin project_name

              并将ios 文件夹移动到我的项目中,运行它就可以了!

              【讨论】:

                【解决方案11】:

                我在运行flutter firebase项目时多次遇到此错误。 简单的解决方案是: 替换:

                # platform :ios, '9.0'platform :ios, '9.0'

                实际上#让它评论,所以我们只是取消评论它。

                【讨论】:

                  【解决方案12】:

                  您不应该删除 Podfile 中的所有内容,只需取消注释此行即可:

                  platform :ios, '9.0'
                  

                  来自ios/Podfile

                  【讨论】:

                    【解决方案13】:

                    你必须删除 # 符号

                    • cd ios
                    • 打开 podfile

                    并删除#符号并保存此文件

                    #platform :ios, '9.0'。

                    然后在终端中编写命令 pod install。

                    【讨论】:

                      【解决方案14】:

                      要解决这个问题: 在 Andriod Studio --> ios--> Podfile 中打开您的 pod 文件,然后您将在文件顶部看到一个注释掉的示例:

                      平台:ios,'9.0'

                      取消注释此行并重新运行应用程序以查看它是否有效。如果仍然无法正常工作,请更改版本以符合您的最低要求。我已将我的设置为 iOS 12,因为我的依赖项之一需要这个。

                      【讨论】:

                        猜你喜欢
                        • 1970-01-01
                        • 2013-02-01
                        • 2021-10-17
                        • 2011-03-09
                        • 1970-01-01
                        • 2019-06-04
                        • 2021-05-01
                        • 1970-01-01
                        • 1970-01-01
                        相关资源
                        最近更新 更多