Fixing `error:iOS 17.0 is not installed. To use with Xcode, first download and install the platform`

Today Fastlane failed deploying an iOS update of my app to the Store with the following error:

error:iOS 17.0 is not installed. To use with Xcode, first download and install the platform

So I opened my project in XCode.

The Run button is disabled, and on the right you can see it says "iOS 17.0 Not Installed. GET". If I click on the Run button, it tells me to download iOS 17.0.

Let's do it!

After installing it, I ran the fastlane script and this time it failed with this error:

warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.0.99. (in target 'firebase_analytics' from project 'Pods')

So I went into my Podfile and changed the first line to:

platform :ios, '12.0'

The warnings disappeared, but it revealed the real cause of the failed compilation:

error: DT_TOOLCHAIN_DIR cannot be used to evaluate LIBRARY_SEARCH_PATHS, use TOOLCHAIN_DIR instead (in target 'FirebaseAnalytics' from project 'Pods')

This error was present earlier but I had failed to see it due to the other warnings.

Some post suggest to change the Podfile loop at the bottom of the file, but I try to stay away from code snippet magic. Another post suggested to upgrade Cocoapods. Let's try that.

% pod --version

% brew upgrade cocoapods
Running `brew update --auto-update`...

Error: cocoapods not installed

% pod --version         

Let's use gem

% sudo gem install cocoapods
Fetching cocoapods-1.13.0.gem
Done installing documentation for xcodeproj, cocoapods-downloader, concurrent-ruby, cocoapods-core, cocoapods after 4 seconds
5 gems installed

% pod --version             

I tried again, same error. So I looked some more and found this ticket. It seems related to the new version of XCode. It seems they also had to ran pod install at the end. Incidentally, they posted this message 14 minutes ago at the time of writing. Great timing! Let's try it:

% cd ios
ios % pod install
Analyzing dependencies
cloud_firestore: Using Firebase SDK version '10.10.0' defined in 'firebase_core'
firebase_analytics: Using Firebase SDK version '10.10.0' defined in 'firebase_core'
firebase_auth: Using Firebase SDK version '10.10.0' defined in 'firebase_core'
firebase_core: Using Firebase SDK version '10.10.0' defined in 'firebase_core'
firebase_dynamic_links: Using Firebase SDK version '10.10.0' defined in 'firebase_core'
Downloading dependencies
Installing fluttertoast 0.0.2
Generating Pods project
Integrating client project

Now it fails with two errors:

error: exportArchive: Unable to process request - PLA Update available

Error Domain=DeveloperAPIServiceErrorDomain Code=5 "Unable to process request - PLA Update available" UserInfo={IDEDistributionIssueSeverity=3, NSLocalizedDescription=Unable to process request - PLA Update available, NSLocalizedRecoverySuggestion=You currently don't have access to this membership resource. To resolve this issue, agree to the latest Program License Agreement in your developer account.}

error: exportArchive: No signing certificate "iOS Distribution" found...

We're getting there! I go to App Store Connect, Agreements at and sure enough, here's a new agreement to agree:

And this time Fastlane successfully uploaded the app to App Store Connect.