iOS minimum version configuration

Hi there! :wave:

We’ve begun our migration from Cordova to Capacitor (v2)! This is the first question I’m posting regarding native project configuration. :sweat_smile:

For setting the iOS minimum version (we’re trying to set it to 13.0), I took a hint from the Capacitor v3 upgrade doc (https://capacitorjs.com/docs/v3/updating/3-0#set-ios-deployment-target-to-120 ) on where to look to configure this. It said to make the change on the App project’s target and project. This made a change to the ios/App/App.xcodeproj/project.pbxproj file and changed all of the IPHONEOS_DEPLOYMENT_TARGET values. So far so good.

I then wondered about the Pods project. Should the deployment target be changed there as well?

Perhaps related, but I see that in the capacitor.config.json file there’s an ios.minVersion setting (https://capacitorjs.com/docs/config ). (Questionably, there’s apparently not an Android analogue to this.) Should this be changed as well? Setting it to 13.0 does not appear to affect the main App project but does change the deployment target in the Pods project. As for pending changes, in addition to the capacitor.config.json changes the ios/App/Podfile is updated.

However, it does not update the deployment target in the Pod project’s targets such as Capacitor and CapacitorCordova. Other targets such as CordovaPlugins and Pods-App were updated to 13.0. Is this expected?

Any help is appreciated! Thank you! :grinning:

Kevin

Here’s what I ended up with in case someone else might find it useful. I also included Android.

OS Versions

Changing iOS Minimum Supported Version

  • In capacitor.config.json, update ios.minVersion. (You can learn a little more about the setting here.)
  • Run npx cap copy to update the copies of capacitor.config.json in the native projects.
  • (The following steps are documented in less detail in official Capacitor upgrade documentation.)
  • Open the project in Xcode (npx cap open ios).
    • In the project navigator/file explorer, click on the App project (has the Xcode project logo).
      • In the App.xcodeproj properties, change the project/target to the App Project if it’s not already selected (the logo is the Xcode project logo–not the app logo).
      • Click the Build Settings tab.
      • Under the Deployment section, update iOS Deployment Target.
      • Repeat the preceeding steps after changing the project/target to the App Target (the logo is the app logo–not the Xcode project logo).
    • These modifications should have resulted in 4 changes to ios/App/App.xcodeproj/project.pbxproj.
  • In ios/App/Podfile, update platform :ios, '<version>'.

Changing Android Minimum and Target Supported Versions

See this article to map between Android OS and Android SDK versions.

See this article if you want to learn more about the version variables we will update.

  • (The following steps are basically documented in official Capacitor upgrade documentation.)
  • In android/variables.gradle,
    • To set the minimum supported Android OS/SDK version, update minSdkVersion.
    • To set the target supported Android OS/SDK version, update compileSdkVersion and targetSdkVersion. They should be the same value.
2 Likes

Just a note, in Capacitor 3 the ios minVersion is gone

Users should change it manually on the Podfile to the version they want and Capacitor won’t change it.

3 Likes

Thanks, Julio! :grinning:

I was wondering if Capacitor 3 had changed that given that ios.minVersion was not mentioned in the Capacitor upgrade documentation. I wasn’t sure though given that it was still present in the v3 Config doc. The Config doc is probably just out of date.

One less thing to update when changing the minimum version!

Thanks again!

In the upgrade guide it’s mentioned that the version on the Podfile needs to be updated manually

But good catch on the config doc, it should be removed from there

1 Like

Hi

I did everything you said about iOS, but I still get the error about the deployment target set to 8.0. I can see in iOS/App/Pods/Pods.xcodeproj/project.pbxproj that for the majority of entries, the target is set to 12.0, a few have 13.0 and two seem to be stuck at 8.0.

The deployment target of the app itself is set to 13.0.

Is there a way to get rid of this warning?

A warning is just that, a warning, as long as it lets you build you shouldn’t worry. Some plugins have dependencies that still support iOS 8, such as @capacitor/network and it causes that warning, other plugins can have similar dependencies too.
But what matters in the end is the deployment target of your app, and the problem is when you have dependencies that require newer versions than the app, not older.