Flutter iOS构建失败,pod文件错误:Podfile已过期

41zrol4v  于 2022-12-30  发布在  Flutter
关注(0)|答案(9)|浏览(281)

我尝试在ios模拟器(ios 13)上构建我的应用程序,但构建失败,并给出pod文件错误:Podfile已过期
这就是错误。

Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Warning: Podfile is out of date
  This can cause a mismatched version of Flutter to be embedded in your app, which may result in App Store submission rejection or crashes.
  If you have local Podfile edits you would like to keep, see https://github.com/flutter/flutter/issues/24641 for instructions.
To regenerate the Podfile, run:
  rm ios/Podfile

Warning: Podfile is out of date
  This can cause issues if your application depends on plugins that do not support iOS.
  See https://flutter.dev/docs/development/packages-and-plugins/developing-packages#plugin-platforms for details.
  If you have local Podfile edits you would like to keep, see https://github.com/flutter/flutter/issues/45197 for instructions.
To regenerate the Podfile, run:
  rm ios/Podfile

Running Xcode build...
Xcode build done.                                            7,8s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **

Xcode's output:
↳
    /Users/kareldebedts/developer/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.11/ios/Classes/CloudFirestorePlugin.m:155:24: error: no visible @interface for 'FIRQuery' declares the selector 'queryWhereField:arrayContainsAny:'
            query = [query queryWhereField:fieldName arrayContainsAny:value];
                     ~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/kareldebedts/developer/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.11/ios/Classes/CloudFirestorePlugin.m:157:24: error: no visible @interface for 'FIRQuery' declares the selector 'queryWhereFieldPath:arrayContainsAny:'
            query = [query queryWhereFieldPath:fieldPath arrayContainsAny:value];
                     ~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/kareldebedts/developer/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.11/ios/Classes/CloudFirestorePlugin.m:163:24: error: no visible @interface for 'FIRQuery' declares the selector 'queryWhereField:in:'
            query = [query queryWhereField:fieldName in:value];
                     ~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/kareldebedts/developer/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.11/ios/Classes/CloudFirestorePlugin.m:165:24: error: no visible @interface for 'FIRQuery' declares the selector 'queryWhereFieldPath:in:'
            query = [query queryWhereFieldPath:fieldPath in:value];
                     ~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/kareldebedts/developer/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore-0.12.11/ios/Classes/CloudFirestorePlugin.m:764:16: warning: 'timestampsInSnapshotsEnabled' is deprecated [-Wdeprecated-declarations]
          settings.timestampsInSnapshotsEnabled = (bool)call.arguments[@"timestampsInSnapshotsEnabled"];
                   ^
    In module 'FirebaseFirestore' imported from /Users/kareldebedts/DRINKM8/drinkm8_git/ios/Pods/Headers/Public/Firebase/Firebase.h:31:
    /Users/kareldebedts/DRINKM8/drinkm8_git/ios/Pods/FirebaseFirestore/Firestore/Source/Public/FIRFirestoreSettings.h:69:20: note: 'timestampsInSnapshotsEnabled' has been explicitly marked deprecated here
        __attribute__((deprecated));
                       ^
    1 warning and 4 errors generated.

Could not build the application for the simulator.
Error launching application on iPhone 11 Pro Max.

我尝试了rm ios/Podfile,但终端说该命令不存在...
这是我的博客。

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^0.1.2
  firebase_core: ^0.4.0
  firebase_auth: ^0.11.1+12
  flutter_facebook_login: ^2.0.1
  cloud_firestore: ^0.12.7+1
  shared_preferences: ^0.5.3+4
  geolocator: ^5.1.1+1
  url_launcher: ^5.1.2
  rflutter_alert: ^1.0.3
  font_awesome_flutter: ^8.5.0
  flutter_picker: ^1.0.13
  uuid: 2.0.1
  image_picker: ^0.6.1
  path_provider: ^1.2.0
  image: ^2.1.4
  firebase_storage: ^3.0.4
  flutter_datetime_picker: ^1.2.5
  intl: ^0.15.8
  native_contact_picker: ^0.0.6
  flutter_spinkit: ^4.0.0
  transparent_image: ^1.0.0
  connectivity: ^0.4.3+7
  flare_splash_screen: ^2.1.3
  algolia: ^0.1.6+1
  http: ^0.12.0+2
  cloud_functions: ^0.4.1+6
  firebase_messaging: ^5.0.2
  avatar_glow: ^1.0.0
  google_maps_flutter: ^0.5.21+8
  geoflutterfire: ^2.0.2
  rxdart: ^0.22.2
  auto_size_text: ^2.1.0
  camera: ^0.5.4+1
  video_player: ^0.10.2+1
  story_view: ^0.11.0
  thumbnails: ^1.0.1
  image_crop: ^0.3.1
  file_picker: ^1.4.2
  pdf_viewer_plugin: ^1.0.0+2
  flutter_background_geolocation: ^1.3.2
  location_permissions: ^2.0.3
  image_downloader: ^0.19.1
  permission_handler: ^3.3.0
  firebase_database: ^3.1.0

有人知道是什么导致了这个问题吗?也许是因为我把模拟器升级到了IOS13。

pepwfjgg

pepwfjgg1#

这通常发生在你升级你的flutter应用程序的时候,要解决这个问题,请按照下面的步骤
1.转到Your_Project_Directory/ios/并删除Podfile,或者可以通过在根项目目录中运行以下命令来执行此操作

rm ios/Podfile
  1. Run您的项目,这将创建一个新的和更新的Podfile为您
flutter run
ipakzgxi

ipakzgxi2#

在你的ios目录下使用pod install命令在你的项目中安装新的pod。即使你已经有了一个pod文件并且之前运行过pod install。这应该对你有用。前段时间我遇到了同样的问题,这是它是如何解决的。

toe95027

toe950273#

我不确定这是否对每个人都有效,但我的问题通过从终端运行flutter run得到了解决。
我刚刚使用了来自vscode的Flutter启动器,它一直在抛出错误。
我已经安装了一个Podfile,但是我想flutter run可能更新了它或者重新安装了它?我不确定。
我的问题是由Flutter更新引起的

ntjbwcob

ntjbwcob4#

MacOS Catalina 已经将默认终端从Bash改为ZSH。因此,我们将配置添加到~/.zshrc,而不是像过去那样添加到~/.bash_profile。
您可以通过运行以下命令随时手动从Bash更改为ZSH:chsh -s /bin/zsh安装Homebrew首先,我们需要安装Homebrew。Homebrew允许我们从源代码轻松安装和编译软件包。
Homebrew附带了一个非常简单的安装脚本,当它要求你安装XCode CommandLine工具时,说是。
打开终端并运行以下命令:ruby -e“$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”现在我们已经安装了Homebrew,我们可以使用它来安装Ruby。
我们将使用rbenv来安装和管理Ruby版本。
为此,请在终端中运行以下命令:brew install rbenv ruby-build将rbenv添加到bash中,以便在每次打开终端时加载它echo 'if which rbenv〉/dev/null;然后eval“$(rbenv初始化-)";〉〉~/.zshrc源文件~/.zshrc

安装Ruby

rbenv install 2.7.2 rbenv global 2.7.2 ruby -v仅此而已在ios目录中使用pod install命令在项目中安装新pod。cd ios pod install enjoy

uz75evzq

uz75evzq5#

运行flutter clean后的建议

pod install --verbose

运行pod install --verbose,因为如果您使用cloud_firestore pod instlal,可能会下载gRPC-Core [https://github.com/grpc/grpc.git],该文件大约为200 MB,但由于它是git子模块,因此最终将下载1GB。因此,要查看正在运行的操作的进度,请运行

voase2hg

voase2hg6#

以防万一,如果有人在更新Podfile后遇到类似于此输出的问题:

ld: framework not found intent
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description

你可以试试这个:
1.转到Xcode选择您的目标。
1.转到生成设置。
1.搜索错误中显示的包名称。例如:找不到框架意图。
1.您将看到其中有一个部分,如下所示:"链接"-〉"其他链接器标志",然后单击此行的粗体部分。
1.它将打开一个对话框,您可以在其中删除未找到的框架。
1.删除框架名称时,还要删除"-framework"标记。
这可能与仅在Android中工作的软件包有关。

zc0qhyus

zc0qhyus7#

如果其他解决方案(sudo arch -x86_64 gem install ffi)不适用,请尝试以下解决方案:

gem install --user-install ffi -- --enable-libffi-alloc

之后,再次运行pod install或您尝试执行的任何操作,但不要使用arch -x86_64作为前缀。
它为我工作没有问题,这样我也可以避免去英特尔仿真(罗塞塔2)的方式。

jexiocij

jexiocij8#

MacOS Catalina已经将默认终端从Bash改为ZSH。因此,我们将配置添加到~/. zshrc,而不是像过去那样添加到~/. bash_profile。
您可以通过运行以下命令随时手动从Bash更改为ZSH:chsh-s/bin/zsh安装Homebrew首先,我们需要安装Homebrew。Homebrew允许我们从源代码轻松安装和编译软件包。
Homebrew附带了一个非常简单的安装脚本,当它要求你安装XCode CommandLine工具时,说是。
打开终端并运行以下命令:ruby-e "$(curl-fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"现在我们已经安装了Homebrew,我们可以使用它来安装Ruby。
我们将使用rbenv来安装和管理Ruby版本。
为此,请在终端中运行以下命令:
brew安装rbenv ruby-build

将rbenv添加到bash中,以便在每次打开终端时加载它

如果rbenv〉/dev/null,则返回"echo";然后eval "$(rbenv初始化-)";〉〉~/. zshrc源文件~/. zshrc

安装Ruby

rbenv install 2.7.2 rbenv global 2.7.2 ruby-v仅此而已在ios目录中使用pod install命令在项目中安装新pod。cd ios pod install enjoy

7nbnzgx9

7nbnzgx99#

转到ios文件夹并尝试pod安装--repo-update

相关问题