Flutter iOS build failed an error of pod files: Podfile is out of date
Asked Answered
H

10

52

I'm trying to build my app on the iOS simulator (iOS 13), but the build fails and gives an error of pod files "Podfile is out of date"

This is the error.

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.

I tried rm ios/Podfile, but the terminal says the command doesn't exist.

This is my 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

What can cause the problem? Maybe it's because I upgraded the simulator to iOS 13.

Hubert answered 16/12, 2019 at 19:6 Comment(1)
Re "pubspec yaml": Do you file pubspec.yaml?Chorea
S
40

This mostly happens when you upgrade your Flutter application. To solve this issue, follow the below steps

  1. Go to Your_Project_Directory/ios/ and remove Podfile or you can do it by running the following command in the root project directory

    rm ios/Podfile
    
  2. Run your project again. This will create a new and updated Podfile for you

    flutter run
    
Shrewsbury answered 19/12, 2019 at 8:35 Comment(1)
in my case, it's 'rm Podfile'Staciestack
N
6

Use pod install command in your ios directory to install new pods in your project. Even if you already have a Podfile and ran pod install before. This should work for you. I ran into the same problem some time ago and this is how it was solved.

Narcosynthesis answered 16/12, 2019 at 19:9 Comment(5)
Thanks! I get this error when I do it... [!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target Runner to Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig or include the Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig in your build configuration (Flutter/Release.xcconfig).Hubert
Does this help ? guides.cocoapods.org/using/pod-install-vs-update.html Please check.. I am not sure why are you getting such error. let me know in comments if things start working.Narcosynthesis
Thank you! Updated the pods, this is the only message I keep getting: 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 github.com/flutter/flutter/issues/24641 for instructions. To regenerate the Podfile, run: rm ios/PodfileHubert
Was everything working before you upgraded your simmulator ?? And I guess simmulator has nothing to do with build.. the issue must be something else..Narcosynthesis
Yes, but when I run flutter upgrade, there was an error when updating. So I reinstalled flutter completely...Hubert
J
3

I'm not sure if this will work for everyone, but my issue was fixed by running flutter run from the terminal.

I was just using the Flutter launcher from Visual Studio Code and it kept throwing errors.

I had a Podfile already setup, but I think flutter run maybe updated it or reinstantiated it? I'm unsure.

My issue was caused by an update to Flutter.

Jaejaeger answered 7/4, 2020 at 12:54 Comment(1)
Keep in mind tho, that this won't report to the debug consoleJaejaeger
R
2

Try to upgrade your Flutter version. I got similar errors and I tried almost every answer but none of them worked. Then I just upgrade my Flutter version to the latest one and the problem solved.

flutter upgrade
Rightful answered 17/3 at 14:13 Comment(0)
P
1

Suggestion

After running flutter clean

pod install --verbose

run pod install --verbose, because if you use cloud_firestore pod install might download gRPC-Core which is approximately 200 MB, but because of it's Git submodules, it will end up downloading 1 GB. So to see progress of what is going on, run

Parabolize answered 3/9, 2020 at 4:34 Comment(2)
Re "So to see progress of what is going on, run": Running away doesn't seem like a viable strategy.Chorea
Isn't something missing?Chorea
R
1

Just in case, if someone runs into a problem similar to this output after updating the 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

You can try this:

  1. Go to Xcode Select your target.
  2. Go to Build Settings.
  3. Search the package name shown in the error. e. g. : framework not found intent.
  4. You will see that there is a section like: "Linking"->"Other linker flags" ,then click the bold part of this row.
  5. It will open a dialog box where you can remove the framework not found.
  6. When removing the framework name, also remove the "-framework" tag.

This may be related to packages that only work in Android.

Rifle answered 21/12, 2020 at 18:20 Comment(0)
L
1

If the other solution (sudo arch -x86_64 gem install ffi) does not work for you, try the following one instead:

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

After that, run pod install or whatever you were trying to do again, but without prefixing it with arch -x86_64.

It worked for me without issues and this way I could also avoid going the Intel emulation (Rosetta 2) way.

Ligetti answered 6/1, 2022 at 6:47 Comment(0)
H
1

Your problem is:

You try to build with deprecated packages.

First of all, try to update the repository:

cd ios && pod repo update
cd ..

If this is not fixing the issue, you should do the following steps to clean your repository and update your packages:

flutter clean

Then update all packages to the major version:

flutter pub upgrade --major-versions

Then to reload the packages:

flutter pub get

After that, change the directory into the ios folder with (--verbose gives you more information):

cd ios && pod install --verbose

Sometimes here are some error messages about outdated packages. They occur like this:

[!] 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.

Then you need to follow the instructions in the error description!

Then change back to the main directory:

cd ..
Harmsworth answered 2/5, 2023 at 6:9 Comment(0)
I
0

Go to the ios folder and try pod install --repo-update.

Invalidate answered 19/12, 2021 at 10:53 Comment(0)
P
0

Thanks to earlier answers, here's a way to get this build config update, without having to actually run the app itself

  • Go to [flutter_project_home]/ios, remove: Podfile, /Pods
  • flutter clean
  • flutter build ios
Pronucleus answered 15/4 at 2:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.