skip to Main Content

So I’ve switched to Xcode 14, and it gave me a lot of compile errors, most of them were related to signing the internal frameworks (the app is well-modularized).
While I’ve been doing that manually (updating about 70 modules), I felt bad as it’s a waste of time, and the problem can happen again in the future.

I’ve found this thread where CODE_SIGN_STYLE=Manual is mentioned, but grep CODE_SIGN_STYLE -r . in a project folder gave me a lot CODE_SIGN_STYLE = Automatic; hits. Also, the checkbox Automatically manage signing is enabled for all of those modules.
enter image description here

I guess it’s Xcode14 bug, so all I wanted to ask:

  1. How have you solved this problem in case you’ve met it?
  2. Could I use some non-custom script like xcodesign-fix-team-for-automatic-signing --team MY_TEAM_ID to do it in 1 click?

UPD: I’ve found such strings in project.pbxproj files those "broken" modules:

                "CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
                "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
                "CODE_SIGN_IDENTITY[sdk=watchos*]" = "";

But after I manually update the Team in Signing tab, that CODE_SIGN_IDENTITY[sdk=iphoneos*] value is still empty.

2

Answers


  1. Chosen as BEST ANSWER

    Solution which worked for me (just added that phase to Podfile):

    post_install do |installer|
      installer.generated_projects.each do |project|
        project.targets.each do |target|
            target.build_configurations.each do |config|
                config.build_settings["DEVELOPMENT_TEAM"] = " Your Team ID  "
             end
        end
      end
    end
    

    I've found it in the CocoaPods issue, which is identical to my problem.

    Before that, I tried to find DEVELOPMENT_TEAM/DevelopmentTeam/Team in the .pbxproj files of individual modules using this advice. But as there was no team specified, it became obvious that this is a CocoaPods issue.


  2. A solution without specifing the team id.
    Good for generic copy-paste.

    post_install do |installer|
        # get team-id from project's first target
        dev_team = ""
        project = installer.aggregate_targets[0].user_project
        project.targets.each do |target|
            target.build_configurations.each do |config|
                if dev_team.empty? and !config.build_settings['DEVELOPMENT_TEAM'].nil?
                    dev_team = config.build_settings['DEVELOPMENT_TEAM']
                    break
                end
            end
        end
      
        # Apply team-id
        installer.pods_project.targets.each do |target|
            target.build_configurations.each do |config|
                config.build_settings["DEVELOPMENT_TEAM"] = dev_team
            end
        end
    end
    

    Inspired from: https://www.jianshu.com/p/685b32c3d521

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search