Skip to content

Instantly share code, notes, and snippets.

@ryanmeisters
Created October 11, 2016 19:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanmeisters/11a95459428a5df5c23c08334bd9e847 to your computer and use it in GitHub Desktop.
Save ryanmeisters/11a95459428a5df5c23c08334bd9e847 to your computer and use it in GitHub Desktop.
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