Last active
March 10, 2025 21:31
-
-
Save ryanmeisters/972cd61933ab1a07b804f197bc98a5fc to your computer and use it in GitHub Desktop.
Fastlane lane to add empty TargetAttributes to pbxproj.
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
# Adds empty TargetAttributes to pbxproj | |
lane :fix_target_attributes do |opts| | |
require 'xcodeproj' | |
xcodeproj_path = opts[:xcodeproj] || File.join(File.dirname(__FILE__), '..', XCODEPROJ_FILE) | |
UI.important("Fixing TargetAttributes in #{xcodeproj_path}") | |
project = Xcodeproj::Project.open(xcodeproj_path) | |
root_object = project.root_object | |
attributes = root_object.attributes | |
if attributes['TargetAttributes'].nil? | |
UI.important("TargetAttributes dictionary is missing, adding an empty one") | |
attributes['TargetAttributes'] = {} | |
project.save | |
UI.success("Successfully added empty TargetAttributes dictionary to project") | |
else | |
UI.message("TargetAttributes dictionary already exists in project") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a workaround for the tuist/fastlane issue here
You can put this in your Fastfile and call it before calling
update_project_codesigning_settings
. I didn't even need to addxcodeproj
to the gemfile since fastlane already uses it.