我尝试在 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
,但终端说该命令不存在...
这是我的 pubspec yaml。
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
什么可能导致问题?可能是因为我把模拟器升级到iOS 13了。
这主要发生在升级 Flutter 应用程序时。要解决此问题,请按照以下步骤操作
转到 Your_Project_Directory/ios/ 并删除 Podfile 或者您可以通过在根项目目录中运行以下命令来完成此操作
rm ios/Podfile
运行您的项目。这将为您创建一个新的且更新的 Podfile
flutter run
在 ios 目录中使用
pod install
命令在项目中安装新的 pod。即使您已经有 Podfile 并之前运行过 pod install。这应该对你有用。我前段时间遇到了同样的问题,这就是解决的方法。
我不确定这是否适用于每个人,但我的问题通过从终端运行
flutter run
得到了解决。
我刚刚使用 Visual Studio Code 中的 Flutter 启动器,但它一直抛出错误。
我已经设置了一个 Podfile,但我认为
flutter run
可能会更新它或重新实例化它?我不确定。
我的问题是由 Flutter 更新引起的。
如果其他解决方案 (
sudo arch -x86_64 gem install ffi
) 不适合您,请尝试以下解决方案:
gem install --user-install ffi -- --enable-libffi-alloc
之后,运行
pod install
或任何您想要再次执行的操作,但不要在其前面加上 arch -x86_64
。
它对我来说没有问题,这样我也可以避免采用英特尔仿真(Rosetta 2)方式。
运行后
flutter clean
pod install --verbose
运行
pod install --verbose
,因为如果您使用 cloud_firestore
pod install 可能会下载约 200 MB 的 gRPC-Core,但由于它是 Git 子模块,最终会下载 1 GB。因此,要查看正在发生的事情的进展,请运行
您的问题是:
您尝试使用已弃用的软件包进行构建。
首先,尝试更新存储库:
cd ios && pod repo update
cd ..
如果这不能解决问题,您应该执行以下步骤来清理存储库并更新包:
flutter clean
然后将所有软件包更新到主要版本:
flutter pub upgrade --major-versions
然后重新加载包:
flutter pub get
之后,将目录更改为 ios 文件夹(--verbose 为您提供更多信息):
cd ios && pod install --verbose
有时这里会出现一些有关过时软件包的错误消息。它们是这样发生的:
[!] CocoaPods could not find compatible versions for pod "FirebaseAppCheck":
In snapshot (Podfile.lock):
FirebaseAppCheck (= 9.6.0, ~> 9.6.0-beta)
In Podfile:
firebase_app_check (from `.symlinks/plugins/firebase_app_check/ios`) was resolved to 0.1.2-3, which depends on
FirebaseAppCheck (~> 10.7.0-beta)
You have either:
* out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
* changed the constraints of dependency `FirebaseAppCheck` inside your development pod `firebase_app_check`.
You should run `pod update FirebaseAppCheck` to apply changes you've made.
那么您需要按照错误描述中的说明进行操作!
然后改回主目录:
cd ..
以防万一,如果有人在更新 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
你可以试试这个:
这可能与仅适用于 Android 的软件包有关。
转到 ios 文件夹并尝试
pod install --repo-update
。