@@ -195,13 +195,16 @@ export class IosProject extends PlatformProject {
195195 * Set the build number (aka the `CURRENT_PROJECT_VERSION`) for the given target and build.
196196 * If the `targetName` is null the main app target is used. If the `buildName` is null the value is set for both builds (Debug/Release);
197197 */
198- async setBuild ( targetName : IosTargetName | null , buildName : IosBuildName | null , buildNumber : number | null ) {
198+ async setBuild ( targetName : IosTargetName | null , buildName : IosBuildName | null , buildNumber : number | string | null ) {
199199 if ( ( buildNumber as any ) === '' ) {
200200 // This shouldn't happen but can
201201 buildNumber = 1 ;
202202 this . pbxProject ?. updateBuildProperty ( 'CURRENT_PROJECT_VERSION' , 1 , buildName , targetName ) ;
203203 } else if ( typeof buildNumber === 'string' ) {
204- buildNumber = parseInt ( buildNumber , 10 ) ;
204+ // Don't parse version strings
205+ if ( buildNumber . indexOf ( '.' ) < 0 ) {
206+ buildNumber = parseInt ( buildNumber , 10 ) ;
207+ }
205208 }
206209
207210 this . pbxProject ?. updateBuildProperty ( 'CURRENT_PROJECT_VERSION' , buildNumber ?? 1 , buildName , targetName ) ;
@@ -254,8 +257,15 @@ export class IosProject extends PlatformProject {
254257 const num = await this . getBuild ( targetName ?? null , buildName ) ;
255258
256259 if ( ! isNaN ( num ) ) {
257- // If the value is a number, increment it
258- return this . setBuild ( targetName ?? null , buildName ?? null , num + 1 ) ;
260+ if ( typeof num === 'number' ) {
261+ // If the value is a number, increment it
262+ return this . setBuild ( targetName ?? null , buildName ?? null , num + 1 ) ;
263+ } else if ( typeof num === 'string' ) {
264+ if ( num . indexOf ( '.' ) < 0 ) {
265+ // If the value is a string and doesn't contain a period, increment it
266+ return this . setBuild ( targetName ?? null , buildName ?? null , parseInt ( num , 10 ) + 1 ) ;
267+ }
268+ }
259269 } else {
260270 // Otherwise, we need to check if there's a build property set for CURRENT_PROJECT_VERSION and create it if not
261271 let currentProjectVersion = this . pbxProject ?. getBuildProperty ( 'CURRENT_PROJECT_VERSION' , buildName ? buildName : undefined /* must use undefined if null */ , targetName ) ;
0 commit comments