Created
October 11, 2016 19:06
-
-
Save ryanmeisters/11a95459428a5df5c23c08334bd9e847 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def replace_project_bundle_identifiers(app_info) | |
# Should use this to replace bundle ids but currently causes gym to fail | |
# https://github.com/fastlane/fastlane/issues/6289 | |
# app_info.all_targets.each { |target| | |
# update_app_identifier( | |
# xcodeproj: app_info.xcodeproj, | |
# plist_path: target.plist_path, | |
# app_identifier: target.app_id | |
# ) | |
# } | |
# Manually find and replace in pbxproj instead | |
default_info = AppInfo::DEV | |
proj_path = File.expand_path('<path_to_project>.xcodeproj/project.pbxproj', __FILE__) | |
pbxproj = File.read(proj_path) | |
default_info.all_targets.zip(app_info.all_targets).each do |default, current| | |
# Find and replace all instances of default.app_id with current.app_id in pbxproj | |
pbxproj = pbxproj.gsub(default.app_id, current.app_id) | |
end | |
File.open(proj_path, 'w') { |file| file.puts pbxproj } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment