146

I changed everything to 9.0 in the project but I'm having the same error in a lot of pods.

I tried doing a lot of different things but nothing worked. Does anyone know how can I fix this?

warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is
9.0 to 14.0.99. (in target 'gRPC-C++-gRPCCertificates-Cpp' from project 'Pods')
warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is
9.0 to 14.0.99. (in target 'GoogleAppMeasurement' from project 'Pods')
warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is
9.0 to 14.0.99. (in target 'FirebaseAuth' from project 'Pods')
warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is
9.0 to 14.0.99. (in target 'GoogleUtilities' from project 'Pods')
warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is
9.0 to 14.0.99. (in target 'vibration' from project 'Pods')
warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is
9.0 to 14.0.99. (in target 'nanopb' from project 'Pods')
warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is
9.0 to 14.0.99. (in target 'BoringSSL-GRPC' from project 'Pods')
warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is
9.0 to 14.0.99. (in target 'gRPC-Core' from project 'Pods')
warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is
9.0 to 14.0.99. (in target 'gRPC-C++' from project 'Pods')

Encountered error while building for device.

matt
  • 485,702
  • 82
  • 818
  • 1,064
Raffaelli L.C.
  • 4,107
  • 4
  • 8
  • 16

17 Answers17

188

What worked for me is a combination of @raffaelli-l-c and @arhan-reddy-busam answer.

Ensure that you do the following:

  • Set MinimumOSVersion to 9.0 in ios/Flutter/AppFrameworkInfo.plist
  • Ensure that you uncomment platform :ios, '9.0' in ios/Podfile
  • Ensure that ios/Podfile contains the following post install script:
    post_install do |installer|
      installer.pods_project.targets.each do |target|
        flutter_additional_ios_build_settings(target)
        target.build_configurations.each do |config|
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
        end
      end
    end

The following routine works for me when doing my production build:

    flutter clean \
        && rm ios/Podfile.lock pubspec.lock \
        && rm -rf ios/Pods ios/Runner.xcworkspace \
        && flutter build ios --build-name=1.0.0 --build-number=1 --release --dart-define=MY_APP_ENV=prod
Je Suis Alrick
  • 2,900
  • 2
  • 13
  • 19
  • 7
    `flutter clean && rm ios/Podfile.lock pubspec.lock && rm -rf ios/Pods ios/Runner.xcworkspace` just executing this did the trick for me – buncis Jan 06 '21 at 16:17
  • 37
    I think this is really ridiculous that we have to edit the Podfile manually for almost a year now. But yes, this does solve the problem. – Cliff Helsel Jan 23 '21 at 18:13
  • 2
    Does not work for me, getting Generate dPluginRegistrant.h:8:9: error: 'Flutter/Flutter.h' file not found #import ^ 1 error generated. :0: error: failed to emit precompiled header – Harsh Phoujdar Apr 17 '21 at 16:10
  • This is finally what worked for me. I was getting an error that said `Error: Member not found: 'packageRoot'. ../…/interface/local_platform.dart:46` `io.Platform.packageRoot; // ignore: deprecated_member_use` – RadicalTurnip Apr 01 '22 at 19:38
68

I solve it with this code, thanks! At the end of the PodFile

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    end
  end
end
Raffaelli L.C.
  • 4,107
  • 4
  • 8
  • 16
  • 1
    Seems interesting, can you explain it's functioning? thanks – funder7 Mar 19 '21 at 00:56
  • Does not work for me, getting error while building ** BUILD FAILED ** Xcode's output: ↳ In file included from flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.27/ios/Classes/FLTPathProviderPlugin.m:5:flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.27/ios/Classes/FLTPathProviderPlugin.h:5:9:fatal error: 'Flutter/Flutter.h' file not found #import ^~~~~~~~~~~~~~~~~~~ 1 error generated. note: Using new build system note: Building targets in parallel note: Planning build note: Constructing build description – Harsh Phoujdar Apr 17 '21 at 16:06
  • @HarshPhoujdar I'm facing the same issue, did you solve it? – Davide Bicego Apr 22 '21 at 08:30
  • 1
    @DavideBicego I have been stuck for past week on this, I am hoping someone replies and helps us. I have gone through a myriad of stackoverflow answers and tried everything. Basically it seems to be stuck in a loop where one solution says to downgrade cocoapods, and flutter 2 says to keep the latest ones. – Harsh Phoujdar Apr 22 '21 at 10:51
  • 2
    @HarshPhoujdar I managed to solve the issue updating most of my dependences. In particular Firebase packages were the problematic ones. They were not compatible with flutter v2 probably. I went from firebase_core: ^0.7.0, firebase_crashlytics: ^0.4.0+1, firebase_messaging: ^8.0.0-dev.15 to firebase_core: ^1.0.4, firebase_crashlytics: ^2.0.1, firebase_messaging: ^9.1.2 – Davide Bicego Apr 22 '21 at 14:05
  • 1
    @bks It deletes the deployment target included for all the targets, so it's set to the default determined by Xcode. – ReinstateMonica3167040 May 26 '21 at 15:15
  • 1
    @ReinstateMonica3167040 Thank you! – bks May 26 '21 at 20:58
  • when i did so. and try to fun. it showed flutter.h not found ... – Sras Sep 03 '21 at 11:33
  • @Sras For flutter apps, `flutter_additional_ios_build_settings(target)` should be added after line `installer.pods_project.targets.each do |target|`. – goldensoju Jun 04 '22 at 23:43
17

go to Pods and for each framework you're using change the iOS version as shown in my screenshot

enter image description here

inzo
  • 888
  • 10
  • 20
  • 1
    This is not correct (at least, not completely) - the script in ios/Podfile is supposed to do this operation automatically, check @"Je suis alrick" answer please! – funder7 Mar 19 '21 at 00:58
16

This is because XCode 12 does only support building for the iOS target versions 9 - 14. Unfortunately the default iOS target set by flutter is 8. But you should be able to change the target in the ios/Runner.xcworkspace file using XCode. See flutter documentation section "Review Xcode project settings" -> headline "Deployment Target:".

You could also try updating flutter to 1.22 beta, which supports iOS 14 and XCode 12 (as noted here)

1024kilobyte
  • 382
  • 3
  • 10
  • 3
    I think Apple needs to work for developer it is so tricky – roun paleum Feb 17 '21 at 15:12
  • 4
    I think Flutter should do a better job of updating the builds. ^ – Modesto Cabrera Feb 20 '21 at 14:06
  • 1
    @rounpaleum if you ever write native code you know that apple does it. I actually forced to do react-native right now and it's a hell compared to go all in native on both plattforms. Every upgrade is a pain in the a** – Tob Jun 13 '21 at 09:57
6

I tried a bunch of things but what seems to have fixed this for me was:

flutter pub cache repair

https://dart.dev/tools/pub/cmd/pub-cache

Cadoo
  • 761
  • 4
  • 13
2

To fix this issue you just need to update the Deployment Target to 9.0. This can be updated by opening the .xcworkspace file, choose the Pods.xcodeproj on Xcode, and updating the iOS Deployment Target to 9.0 or later as the like image below

Open ios/Runner.xcworkspace in Xcode and change

enter image description here

You can't provide support for iOS 8.0 on Xcode 12 unless you import the support files. To provide support by default you would have to use Xcode 11. It would be better to check for the number of users that use your app on iOS 8 and update the minimum supported version to iOS 9 or higher.

Paresh Mangukiya
  • 37,512
  • 17
  • 201
  • 182
2

For me what worked is, open XCode in ios folder. Then check and fix possible account related problem in Signing section. Then run flutter run again. And it worked. Not sure why is it related to this error but it worked.

2

After couple of days trying to figure out what to do.

The only thing that worked for me was deleting the entire ios directory in my Flutter project, then rebuilding it:

flutter create .

Add GoogleService-Info.plist to Runner. Add signing & capabilities in Xcode. Add target properties in Xcode such as sign-in.

As mentioned in: https://stackoverflow.com/a/67224108/7749979

TuGordoBello
  • 3,938
  • 7
  • 44
  • 71
Omer.rah
  • 51
  • 5
1

Make sure, in any of your dart files has not imported the dart.html package. This caused a problem in my case when flutter tries to install the pod.

dilip
  • 133
  • 8
0

Just Follow Below Command Line in Your macOS

  1. flutter clean
  2. rm ios/Podfile.lock pubspec.lock
  3. rm ios/Podfile.lock pubspec.lock
  4. rm -rf ios/Pods ios/Runner.xcworkspace
0
  1. Open Xcode
  2. Change Project Document - Project format - Xcode 8.0-Compatible
  3. Flutter clean, flutter pub get and flutter build iOS
stateMachine
  • 4,140
  • 3
  • 11
  • 25
0

After trying most of these solutions the only thing that worked for me is to uncomment and add ios 10 in ios/Podfile:

platform :ios, '10.0'
0

In my case this error was misleading.

Turns out, the problem was caused by a missing step in Firebase upgrade docs: delete the Fabric build step in XCode.

Here's the article I found that actually solved the cause of this error for me: SO post towards the bottom it mentions the Fabric dependency.

I added the new Run Script in XCode per the firebase docs referenced, removed the Fabric related build phase, and the 8.0 target error went away.

I hope this helps anyone else who went down the PodFile dependency rabbit hole that I did.

Nathan Agersea
  • 366
  • 2
  • 16
0

I got so fed up, so I just compiled in Xcode 13. Works for me! Since upgrading to Flutter 2.5.2, I got this weird issue. Minor hassle.

ios/Podfile:

platform :ios, '10.0'

I change minimumOS to 10

ouflak
  • 2,408
  • 10
  • 40
  • 47
0

Change MinimumOSVersion to 9.0 in /ios/Flutter/AppFrameworkInfo.plist.

Then in ios/Runner.xcodeproj/project.bpxproj replace IPHONEOS_DEPLOYMENT_TARGET = 8.0 to IPHONEOS_DEPLOYMENT_TARGET = 9.0 in three lines.

It also works if you are building your .ipa whit codemagic

Mátyás Grőger
  • 918
  • 8
  • 21
Joel C
  • 1
  • 1
0

It means you have a bad dart code in your project try to find bad loops in your code, and remove import 'dart:html'; if you not using it.

No matter how hard u try flutter will throw 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0 even if you create fresh flutter project and you copy the same code in it, it will still throw error.

test
  • 2,349
  • 15
  • 40
  • 76
-2

When updating to iOs 14.4 it seems that the path_provider package is not compatible with target 10.0. Currently Firebase package requires target 10.0. Here's the problem, I've had the problem for a month now. Maybe the Flutter team can help. When building iOs, there is an error that cannot be fixed, hic hic.

Launching lib/main.dart on iPhone 12 Pro in debug mode... Running pod install... Running Xcode build... Xcode build done. 29.4s Failed to build iOS app Error output from Xcode build: ↳ ** BUILD FAILED **

Xcode's output: ↳ In file included from /Users/maitrongtue/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.1/ios/Classes/FLTPathProviderPlugin.m:5: /Users/maitrongtue/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.1/ios/Classes/FLTPathProviderPlugin.h:5:9: fatal error: 'Flutter/Flutter.h' file not found #import <Flutter/Flutter.h> ^~~~~~~~~~~~~~~~~~~ 1 error generated. note: Using new build system note: Building targets in parallel note: Planning build note: Constructing build description

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