@@ -251,6 +251,22 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
251251 let projectRoot = platformData . projectRoot ;
252252 let archivePath = options . archivePath ;
253253 let buildOutputPath = path . join ( projectRoot , "build" , "device" ) ;
254+ let exportOptionsMethod = await this . getExportOptionsMethod ( projectData ) ;
255+ let plistTemplate = `<?xml version="1.0" encoding="UTF-8"?>
256+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
257+ <plist version="1.0">
258+ <dict>
259+ <key>method</key>
260+ <string>${ exportOptionsMethod } </string>
261+ <key>uploadBitcode</key>
262+ <false/>
263+ </dict>
264+ </plist>` ;
265+
266+ // Save the options...
267+ temp . track ( ) ;
268+ let exportOptionsPlist = temp . path ( { prefix : "export-" , suffix : ".plist" } ) ;
269+ this . $fs . writeFile ( exportOptionsPlist , plistTemplate ) ;
254270
255271 // The xcodebuild exportPath expects directory and writes the <project-name>.ipa at that directory.
256272 let exportPath = path . resolve ( options . exportDir || buildOutputPath ) ;
@@ -259,7 +275,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
259275 let args = [ "-exportArchive" ,
260276 "-archivePath" , archivePath ,
261277 "-exportPath" , exportPath ,
262- "-exportOptionsPlist" , platformData . configurationFilePath
278+ "-exportOptionsPlist" , exportOptionsPlist
263279 ] ;
264280 await this . $childProcess . spawnFromEvent ( "xcodebuild" , args , "exit" ,
265281 { stdio : buildConfig . buildOutputStdio || 'inherit' , cwd : this . getPlatformData ( projectData ) . projectRoot } ,
@@ -1331,6 +1347,18 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
13311347 this . $logger . warnWithLabel ( "The CFBundleIdentifier key inside the 'Info.plist' will be overriden by the 'id' inside 'package.json'." ) ;
13321348 }
13331349 }
1350+
1351+ private getExportOptionsMethod ( projectData : IProjectData ) : string {
1352+ const embeddedMobileProvisionPath = path . join ( this . getPlatformData ( projectData ) . deviceBuildOutputPath , `${ projectData . projectName } .app` , "embedded.mobileprovision" ) ;
1353+ const provision = mobileprovision . provision . readFromFile ( embeddedMobileProvisionPath ) ;
1354+
1355+ return {
1356+ "Development" : "development" ,
1357+ "AdHoc" : "ad-hoc" ,
1358+ "Distribution" : "app-store" ,
1359+ "Enterprise" : "enterprise"
1360+ } [ provision . Type ] ;
1361+ }
13341362}
13351363
13361364$injector . register ( "iOSProjectService" , IOSProjectService ) ;
0 commit comments