2

In a quest to automate the iOS app generation process, I am trying to set change the settings of a build target in an automated fashion outside of XCode. Specifically, I would like to set the Info.plist file for a target using a command or some other programatic approach. In essence, I would like to do the following but without the XCode GUI:

enter image description here

What I have tried:

  • Using xcodeproj. I used this approach to create the target using a Ruby script but I have not seen an easy way to set the plist file. If this is possible with xcodeproj, this would be the ideal solution as I am already using it to create the target.
  • Using xcodebuild such as in this answer. I did not have any luck with this method and I do not think the changes to the target variables are permanent anyway.

I am open to any methods for accomplishing this as long as they can be performed within code or a script.

Community
  • 1
  • 1
Adam Jakiela
  • 2,188
  • 7
  • 30
  • 48
  • you should look into fastlane. Its a suite of tools to help basically every app store process you could imagine – arc4randall Mar 09 '16 at 21:07
  • I actually use Fastlane in other areas of my deployment. Unfortunately Fastlane does not have many tools for creating and modifying targets - at least not to my knowledge. – Adam Jakiela Mar 09 '16 at 21:19
  • What about something like this? https://developer.apple.com/library/ios/qa/qa1827/_index.html – arc4randall Mar 09 '16 at 21:29
  • This looks like it modifies the properties of an existing plist file but I do not see where it sets the plist file for the target. – Adam Jakiela Mar 09 '16 at 21:49

1 Answers1

0

After giving xcodeproj a second chance, I was able to modify the build settings of the target. After creating a new target app_target, a build setting for a target can be set as follows:

app_target.build_configurations.each do |config|
    config.build_settings['INFOPLIST_FILE'] = iosProjectDir + "/myplist.plist"
end

This ended up resolving the issue and the changes are reflected within XCode.

Adam Jakiela
  • 2,188
  • 7
  • 30
  • 48