@@ -8,6 +8,7 @@ import c from '../colors';
88import { getCoreVersion , runTask , checkJDKMajorVersion } from '../common' ;
99import type { Config } from '../definitions' ;
1010import { fatal } from '../errors' ;
11+ import { getMajoriOSVersion } from '../ios/common' ;
1112import { logger , logPrompt , logSuccess } from '../log' ;
1213import { getPlugins } from '../plugin' ;
1314import { deleteFolderRecursive } from '../util/fs' ;
@@ -48,6 +49,7 @@ const plugins = [
4849const coreVersion = '^7.0.0' ;
4950const pluginVersion = '^7.0.0' ;
5051const gradleVersion = '8.11.1' ;
52+ const iOSVersion = '14' ;
5153let installFailed = false ;
5254
5355export async function migrateCommand ( config : Config , noprompt : boolean , packagemanager : string ) : Promise < void > {
@@ -90,7 +92,7 @@ export async function migrateCommand(config: Config, noprompt: boolean, packagem
9092
9193 const { migrateconfirm } = noprompt
9294 ? { migrateconfirm : 'y' }
93- : await logPrompt ( `Capacitor 7 sets a deployment target of iOS 14 and Android 15 (SDK 35). \n` , {
95+ : await logPrompt ( `Capacitor 7 sets a deployment target of iOS ${ iOSVersion } and Android 15 (SDK 35). \n` , {
9496 type : 'text' ,
9597 name : 'migrateconfirm' ,
9698 message : `Are you sure you want to migrate? (Y/n)` ,
@@ -147,23 +149,33 @@ export async function migrateCommand(config: Config, noprompt: boolean, packagem
147149
148150 // Update iOS Projects
149151 if ( allDependencies [ '@capacitor/ios' ] && existsSync ( config . ios . platformDirAbs ) ) {
150- // ios template changes
151- // Set deployment target to 14.0
152- await runTask ( `Migrating deployment target to 14.0.` , ( ) => {
153- return updateFile (
154- config ,
155- join ( config . ios . nativeXcodeProjDirAbs , 'project.pbxproj' ) ,
156- 'IPHONEOS_DEPLOYMENT_TARGET = ' ,
157- ';' ,
158- '14.0' ,
159- ) ;
160- } ) ;
161-
162- if ( ( await checkPackageManager ( config ) ) === 'Cocoapods' ) {
163- // Update Podfile to 14.0
164- await runTask ( `Migrating Podfile to 14.0.` , ( ) => {
165- return updateFile ( config , join ( config . ios . nativeProjectDirAbs , 'Podfile' ) , `platform :ios, '` , `'` , '14.0' ) ;
152+ const currentiOSVersion = getMajoriOSVersion ( config ) ;
153+ if ( parseInt ( currentiOSVersion ) < parseInt ( iOSVersion ) ) {
154+ // ios template changes
155+ await runTask ( `Migrating deployment target to ${ iOSVersion } .0.` , ( ) => {
156+ return updateFile (
157+ config ,
158+ join ( config . ios . nativeXcodeProjDirAbs , 'project.pbxproj' ) ,
159+ 'IPHONEOS_DEPLOYMENT_TARGET = ' ,
160+ ';' ,
161+ `${ iOSVersion } .0` ,
162+ ) ;
166163 } ) ;
164+
165+ if ( ( await checkPackageManager ( config ) ) === 'Cocoapods' ) {
166+ // Update Podfile
167+ await runTask ( `Migrating Podfile to ${ iOSVersion } .0.` , ( ) => {
168+ return updateFile (
169+ config ,
170+ join ( config . ios . nativeProjectDirAbs , 'Podfile' ) ,
171+ `platform :ios, '` ,
172+ `'` ,
173+ `${ iOSVersion } .0` ,
174+ ) ;
175+ } ) ;
176+ }
177+ } else {
178+ logger . warn ( 'Skipped updating deployment target' ) ;
167179 }
168180 }
169181
0 commit comments