@@ -360,6 +360,34 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
360360 return Future . fromResult ( ) ;
361361 }
362362
363+ private getDeploymentTarget ( project : xcode . project ) : string {
364+ let configurations = project . pbxXCBuildConfigurationSection ( ) ;
365+
366+ for ( let configName in configurations ) {
367+ if ( ! Object . prototype . hasOwnProperty . call ( configurations , configName ) ) {
368+ continue ;
369+ }
370+
371+ let configuration = configurations [ configName ] ;
372+ if ( typeof configuration !== "object" ) {
373+ continue ;
374+ }
375+
376+ let buildSettings = configuration . buildSettings ;
377+ if ( buildSettings [ "IPHONEOS_DEPLOYMENT_TARGET" ] ) {
378+ return buildSettings [ "IPHONEOS_DEPLOYMENT_TARGET" ] ;
379+ }
380+ }
381+ }
382+
383+ private ensureIos8DeploymentTarget ( project : xcode . project ) {
384+ // tns-ios@2.1.0+ has a default deployment target of 8.0 so this is not needed there
385+ if ( this . getDeploymentTarget ( project ) === "7.0" ) {
386+ project . updateBuildProperty ( "IPHONEOS_DEPLOYMENT_TARGET" , "8.0" ) ;
387+ this . $logger . info ( "The iOS Deployment Target is now 8.0 in order to support Cocoa Touch Frameworks." ) ;
388+ }
389+ }
390+
363391 private addDynamicFramework ( frameworkPath : string ) : IFuture < void > {
364392 return ( ( ) => {
365393 this . validateFramework ( frameworkPath ) . wait ( ) ;
@@ -378,8 +406,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
378406
379407 if ( isDynamic ) {
380408 frameworkAddOptions [ "embed" ] = true ;
381- project . updateBuildProperty ( "IPHONEOS_DEPLOYMENT_TARGET" , "8.0" ) ;
382- this . $logger . info ( "The iOS Deployment Target is now 8.0 in order to support Cocoa Touch Frameworks." ) ;
409+ this . ensureIos8DeploymentTarget ( project ) ;
383410 }
384411
385412 let frameworkRelativePath = this . getLibSubpathRelativeToProjectPath ( path . basename ( frameworkPath ) ) ;
@@ -910,8 +937,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
910937 this . $fs . writeFile ( this . projectPodFilePath , contentToWrite ) . wait ( ) ;
911938
912939 let project = this . createPbxProj ( ) ;
913- project . updateBuildProperty ( "IPHONEOS_DEPLOYMENT_TARGET" , "8.0" ) ;
914- this . $logger . info ( "The iOS Deployment Target is now 8.0 in order to support Cocoa Touch Frameworks in CocoaPods." ) ;
940+ this . ensureIos8DeploymentTarget ( project ) ;
915941 this . savePbxProj ( project ) . wait ( ) ;
916942 }
917943 }
0 commit comments