@@ -299,7 +299,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
299
299
300
300
let xcodeBuildVersion = await this . getXcodeVersion ( ) ;
301
301
if ( helpers . versionCompare ( xcodeBuildVersion , "8.0" ) >= 0 ) {
302
- await this . setupAutomaticSigning ( projectRoot , buildConfig ) ;
302
+ await this . setupSigningForDevice ( projectRoot , buildConfig ) ;
303
303
}
304
304
305
305
if ( buildConfig && buildConfig . codeSignIdentity ) {
@@ -321,7 +321,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
321
321
await this . createIpa ( projectRoot ) ;
322
322
}
323
323
324
- private async setupManualSigning ( projectRoot : string , buildConfig ?: IiOSBuildConfig ) : Promise < void > {
324
+ private async setupSigningFromProvision ( projectRoot : string , buildConfig ?: IiOSBuildConfig ) : Promise < void > {
325
325
if ( this . $options . provision ) {
326
326
const pbxprojPath = path . join ( projectRoot , this . $projectData . projectName + ".xcodeproj" , "project.pbxproj" ) ;
327
327
const xcode = Xcode . open ( pbxprojPath ) ;
@@ -369,12 +369,15 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
369
369
}
370
370
}
371
371
372
- private async setupAutomaticSigning ( projectRoot : string , buildConfig ?: IiOSBuildConfig ) : Promise < void > {
372
+ private async setupSigningForDevice ( projectRoot : string , buildConfig ?: IiOSBuildConfig ) : Promise < void > {
373
373
const pbxprojPath = path . join ( projectRoot , this . $projectData . projectName + ".xcodeproj" , "project.pbxproj" ) ;
374
374
const xcode = Xcode . open ( pbxprojPath ) ;
375
375
const signing = xcode . getSigning ( this . $projectData . projectName ) ;
376
376
377
- if ( ! this . $options . provision && ! ( signing && signing . style === "Manual" && ! this . $options . teamId ) ) {
377
+ if ( ( this . readXCConfigProvisioningProfile ( ) || this . readXCConfigProvisioningProfileForIPhoneOs ( ) ) && ( ! signing || signing . style !== "Manual" ) ) {
378
+ xcode . setManualSigningStyle ( this . $projectData . projectName ) ;
379
+ xcode . save ( ) ;
380
+ } else if ( ! this . $options . provision && ! ( signing && signing . style === "Manual" && ! this . $options . teamId ) ) {
378
381
if ( buildConfig ) {
379
382
delete buildConfig . teamIdentifier ;
380
383
}
@@ -385,7 +388,6 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
385
388
xcode . save ( ) ;
386
389
this . $logger . trace ( "Set Automatic signing style and team." ) ;
387
390
}
388
-
389
391
}
390
392
391
393
private async buildForSimulator ( projectRoot : string , args : string [ ] , buildConfig ?: IiOSBuildConfig ) : Promise < void > {
@@ -564,7 +566,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
564
566
public async prepareProject ( ) : Promise < void > {
565
567
if ( this . $options . provision ) {
566
568
let projectRoot = path . join ( this . $projectData . platformsDir , "ios" ) ;
567
- await this . setupManualSigning ( projectRoot ) ;
569
+ await this . setupSigningFromProvision ( projectRoot ) ;
568
570
}
569
571
570
572
let project = this . createPbxProj ( ) ;
@@ -1081,14 +1083,14 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
1081
1083
return null ;
1082
1084
}
1083
1085
1084
- private readTeamId ( ) : string {
1086
+ private readXCConfig ( flag : string ) : string {
1085
1087
let xcconfigFile = path . join ( this . $projectData . appResourcesDirectoryPath , this . platformData . normalizedPlatformName , "build.xcconfig" ) ;
1086
1088
if ( this . $fs . exists ( xcconfigFile ) ) {
1087
1089
let text = this . $fs . readText ( xcconfigFile ) ;
1088
1090
let teamId : string ;
1089
1091
text . split ( / \r ? \n / ) . forEach ( ( line ) => {
1090
1092
line = line . replace ( / \/ ( \/ ) [ ^ \n ] * $ / , "" ) ;
1091
- if ( line . indexOf ( "DEVELOPMENT_TEAM" ) >= 0 ) {
1093
+ if ( line . indexOf ( flag ) >= 0 ) {
1092
1094
teamId = line . split ( "=" ) [ 1 ] . trim ( ) ;
1093
1095
if ( teamId [ teamId . length - 1 ] === ';' ) {
1094
1096
teamId = teamId . slice ( 0 , - 1 ) ;
@@ -1108,6 +1110,18 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
1108
1110
return null ;
1109
1111
}
1110
1112
1113
+ private readTeamId ( ) : string {
1114
+ return this . readXCConfig ( "DEVELOPMENT_TEAM" ) ;
1115
+ }
1116
+
1117
+ private readXCConfigProvisioningProfile ( ) : string {
1118
+ return this . readXCConfig ( "PROVISIONING_PROFILE" ) ;
1119
+ }
1120
+
1121
+ private readXCConfigProvisioningProfileForIPhoneOs ( ) : string {
1122
+ return this . readXCConfig ( "PROVISIONING_PROFILE[sdk=iphoneos*]" ) ;
1123
+ }
1124
+
1111
1125
private async getDevelopmentTeam ( ) : Promise < string > {
1112
1126
let teamId : string ;
1113
1127
if ( this . $options . teamId ) {
0 commit comments