Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xcode 14 build failed with manual code sign and app resource bundles #11402

Closed
1 task
blastmann opened this issue Jun 8, 2022 · 85 comments · Fixed by #11723
Closed
1 task

Xcode 14 build failed with manual code sign and app resource bundles #11402

blastmann opened this issue Jun 8, 2022 · 85 comments · Fixed by #11723
Milestone

Comments

@blastmann
Copy link

blastmann commented Jun 8, 2022

Report

What did you do?

  1. Integrate a pod with resource bundle.
  2. Set app code sign style to Manual.
  3. Build app with Xcode 14 beta.
  4. It should failed with errors like below:

WeChatWorkScreenshot_512ff8ee-cbe9-491f-bdf9-98c238fb8f4b

What did you expect to happen?

It should build success.

What happened instead?

Build failed.

CocoaPods Environment

Stack

   CocoaPods : 1.11.2
        Ruby : ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin20]
    RubyGems : 3.1.4
        Host : macOS 12.4 (21F79)
       Xcode : 13.4 (13F17a)
         Git : git version 2.29.2
Ruby lib dir : /Users/eddiechan/.rbenv/versions/2.7.2/lib
Repositories : 
               trunk - CDN - https://cdn.cocoapods.org/

Installation Source

Executable Path: /Users/eddiechan/.rbenv/versions/2.7.2/bin/pod

Plugins

cocoapods-check                       : 1.1.0
cocoapods-deintegrate                 : 1.0.5
cocoapods-disable-podfile-validations : 0.1.1
cocoapods-generate                    : 2.2.2
cocoapods-open                        : 0.0.8
cocoapods-plugins                     : 1.0.0
cocoapods-search                      : 1.0.1
cocoapods-trunk                       : 1.6.0
cocoapods-try                         : 1.2.0

Project that demonstrates the issue

Xcode14ResBundle.zip

@linconz
Copy link

linconz commented Jun 8, 2022

same issue, but you can use XCConfig to resolve like this:
First, find your Team ID in Apple Developer Membership.
Second, change your 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

@blastmann
Copy link
Author

blastmann commented Jun 9, 2022

@linconz Yes, I solve this issue by using post_install script too.

@Buju77
Copy link

Buju77 commented Jun 15, 2022

just out of curiosity, will this be fixed in Cocoapods in the end or is this just some Xcode 14 Beta 1 bug and we are hoping Apple will fix it in future betas and the bug will magically go away?

@cdoky
Copy link

cdoky commented Jun 23, 2022

The same problem.

@cdoky
Copy link

cdoky commented Jun 23, 2022

The Xcode14.0Beta2 fixed the problem.

@dmcgloin
Copy link

dmcgloin commented Jun 23, 2022

Xcode 14 Beta 2 actually resolves problem for me

@Buju77
Copy link

Buju77 commented Jun 23, 2022

Just tried Xcode 14.0 beta 2 (14A5229c) and still the same issue:

error: Cannot code sign because the target does not have an Info.plist file and one is not being generated automatically. Apply an Info.plist file to the target using the INFOPLIST_FILE build setting or generate one automatically by setting the GENERATE_INFOPLIST_FILE build setting to YES (recommended). (in target 'App' from project 'App')

@evandorn
Copy link

Fwiw this was not fixed for my project in Xcode 14 beta 2 either, the same issue persists.

@damonxiao154
Copy link

same issue in Xcode 14.0 beta 2

@rubencalde
Copy link

After getting the same issue mentioned above, with RealmSwift 10.28.1:
error: Cannot code sign because the target does not have an Info.plist file and one is not being generated automatically. Apply an Info.plist file to the target using the INFOPLIST_FILE build setting or generate one automatically by setting the GENERATE_INFOPLIST_FILE build setting to YES (recommended). (in target 'App' from project 'App') ** BUILD FAILED **
We were able to fix this, by updating to the latest version of CocoaPods, 1.11.3 with version 1.22.0 of the xcodeproj gem. In this way it has been possible to validate the RealmSwift podspec.

Rubén

@1677
Copy link

1677 commented Jul 4, 2022

I wrote a CocoaPods plugin to solve this problem, everyone is welcome to use cocoapods-pod-sign

@dyegos
Copy link

dyegos commented Jul 18, 2022

I am still having issues with it using Xcode 14 beta 3. Is there going to be any fix from Cocoapods or are we waiting for Xcode to fix itself?

@1677 the plugin is awesome. However, it's not working on Xcode beta 3 :/
This application or a bundle it contains has the same bundle identifier as this application or another bundle that it contains. Bundle identifiers must be unique.

@li6185377
Copy link

same issue, but you can use XCConfig to resolve like this: First, find your Team ID in Apple Developer Membership. Second, change your 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

Automatically get main project Team ID

post_install do |installer|
    # Get main project development team id
    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']
            end
        end
    end
    
    # Fix bundle targets' 'Signing Certificate' to 'Sign to Run Locally'
    installer.pods_project.targets.each do |target|
        if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
            target.build_configurations.each do |config|
                config.build_settings['DEVELOPMENT_TEAM'] = dev_team
            end
        end
    end
end

@blastmann
Copy link
Author

Actually, we can also set the CODE_SIGN_IDENTITY empty in order to avoid this issue, that's much easier. Like this:

    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['CODE_SIGN_IDENTITY'] = ''
        end
    end

@knox
Copy link

knox commented Jul 28, 2022

Actually, we can also set the CODE_SIGN_IDENTITY empty

Doesn't work for me when building for a device

@doge1024
Copy link

doge1024 commented Aug 1, 2022

Fix Xcode14 bundle need sign

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
      target.build_configurations.each do |config|
          config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
      end
    end
  end
end

@fabiendem
Copy link

Hey, I can't find any good documentation around CODE_SIGNING_ALLOWED.
But CODE_SIGNING sounds important so I am a bit reluctant to drop that in our config without knowing what it's doing.
Could one of you clarify this please?

@kconner
Copy link

kconner commented Sep 12, 2022

Issue is still present in CocoaPods 1.11.3 and GM release Xcode 14.0 (14A309). Applying one of these post-install measures would let me begin using Xcode 14 for now, but I'd like to do without a workaround.

@anmolghosh
Copy link

@dnkoutso When can we expect the release of 1.12.0? If the 1.12.0 timeline is not near its end, can this be released as patch to 1.11 instead?

@zoobibackups
Copy link

Add this to pod file

 post_install do |installer|
    react_native_post_install(installer)
    
    
    #############
      installer.pods_project.targets.each do |target|
            
        ### Added for Maps
        if target.name == 'RCT-Folly'
          target.build_configurations.each do |config|
            config.build_settings['HEADER_SEARCH_PATHS'] = "$(inherited) ${PODS_ROOT}/fmt/include"
            config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
          end
        end
        #### Added For Maps Ended 

        if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
          target.build_configurations.each do |config|
              config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
              config.build_settings["DEVELOPMENT_TEAM"] = "G2BW7BNX6K" 
          end
        end
      end
    ############


    installer.pods_project.build_configurations.each do |config|
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
      config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
      config.build_settings["ONLY_ACTIVE_ARCH"] = "YES"
    end
    #__apply_Xcode_12_5_M1_post_install_workaround(installer)
  
  end
end

@douglascarvalho
Copy link

Updating Cocoapods to 1.12.0 fixed the error for me on Xcode 14.2. Thanks.

@UberMC
Copy link

UberMC commented Mar 16, 2023

Updating Cocoapods to 1.12.0 fixed the error for me on Xcode 14.2. Thanks.

Thanks this also fixed AccessibilityResources.bundle' does not contain a bundle executable.
Since setting generate_Info_plist on the pods caused that error.

@plindsay
Copy link

I'm running into these issues too with Xcode 14 but struggling to update Cocoapods within my project to 1.12.0

If I run gem install cocoapods it looks like it installs 1.12.0 but if I run pod --version inside my ios directory it still shows version 1.11.2

How can I update my project to use Cocoapods 1.12.0?

@julestruong
Copy link

julestruong commented Mar 23, 2023

I'm running into these issues too with Xcode 14 but struggling to update Cocoapods within my project to 1.12.0

If I run gem install cocoapods it looks like it installs 1.12.0 but if I run pod --version inside my ios directory it still shows version 1.11.2

How can I update my project to use Cocoapods 1.12.0?

in your gemfile, don't you have something like this ?

gem 'cocoapods', '1.11.2'

change it to 1.12.0 and rerun : gem install?

@tomwanzek
Copy link

So the good news is that Cocoapods 1.12.0 seems to have addressed the iOS build issues we saw in our CI/CD pipeline after trying to bump it to latest XCode and fastlane stable releases. So 🙇 for that 😄

@plindsay I had the same experience, unlike any of my previous cocoapods upgrades to my local dev environment, this one created all sorts of weird behaviors. It wasn't really updating the discovered version in the existing path. I could find the executable and ran it directly with --version. While it did show the correct version 1.12.0, somehow it was barking that all its plugins were missing.

I updated my PATH variable based on some more paths from gem environment, but the issue with the missing plug-ins persisted.

Oddly enough, in the project repo I needed it in, we also have a Gemfile for use with bundler. Essentially for the CI/CD pipeline. When I manually updated it and ran bundler install the Gemfile lock was correctly updated including the cocoapods plug-ins.

Running bundler exec pod install in the same folder (it also contains the projects Podfile) ran 1.12.0 without any plug-in missing warnings.

TBH, not sure what's up with that. It's never been an issue before.

@plindsay
Copy link

Thanks @julestruong & @tomwanzek - updated the Gemfile to read gem 'cocoapods', '1.12.0' then gem install cocoapods once again. All went well, then cd into ios/ and ran bundler install - see output below -

Fetching gem metadata from https://rubygems.org/........
Resolving dependencies...
Using rexml 3.2.5
Using CFPropertyList 3.0.6
Using concurrent-ruby 1.2.2
Using i18n 1.12.0
Using minitest 5.18.0
Using tzinfo 2.0.6
Using activesupport 7.0.4.3
Using public_suffix 4.0.7
Using addressable 2.8.1
Using httpclient 2.8.3
Using json 2.6.3
Using algoliasearch 1.27.5
Using atomos 0.1.3
Using bundler 2.1.4
Using claide 1.1.0
Using fuzzy_match 2.0.4
Using nap 1.1.0
Using netrc 0.11.0
Using ffi 1.15.5
Using ethon 0.16.0
Using typhoeus 1.4.0
Using cocoapods-core 1.12.0
Using cocoapods-deintegrate 1.0.5
Using cocoapods-downloader 1.6.3
Using cocoapods-plugins 1.0.0
Using cocoapods-search 1.0.1
Using cocoapods-trunk 1.6.0
Using cocoapods-try 1.2.0
Using colored2 3.1.2
Using escape 0.0.4
Using fourflusher 2.3.1
Using gh_inspector 1.1.3
Using molinillo 0.8.0
Using ruby-macho 2.5.1
Using nanaimo 0.3.0
Using xcodeproj 1.22.0
Using cocoapods 1.12.0
Bundle complete! 1 Gemfile dependency, 37 gems now installed.
Bundled gems are installed into ../vendor/bundle

Then ran bundler exec pod install which again ran without errors, however pod --version still shows 1.11.2 and Xcode archive builds still fail... Have I missed a step somewhere?...

@julestruong
Copy link

That's odd.
Mine shows 1.12 and archive build successfully :(
Maybe there is another issue

@penghuili
Copy link

It seems upgrading cocoapods to 1.12.0 fixes the problem for everyone, but my current situation is this:

before upgrading cocoapods, we can't even publish the build from our CI to TestFlight, we always get the ITMS-90129: The bundle uses a bundle name or display name that is already taken. error message.

then we upgraded cocoapds, we can now publish the build from CI to TestFlight, but we will immediately get an email from apple, with exactly the same error message ITMS-90129: The bundle uses a bundle name or display name that is already taken., and the build won't appear in TestFlight.

does anyone have the same problem? or anyone has any idea?
thx 🙏

@adamdahan
Copy link

1.12.0 does not fix the problem for everyone.

@Harukisatoh
Copy link

I'm currently using App Center as CI, and updating the Cocoapods to 1.12.0 has no effect for me. The post install workarounds also don't work. All these solutions works locally, but not on CI. Any new solutions?

@nodrock
Copy link

nodrock commented Mar 29, 2023

We use this workaround since day one of XCode 14 and it worked with older Cocoapods as well as 1.12.0. We add these lines on CI to all projects:

post_install do |installer|
    # Get main project development team id
    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']
            end
        end
    end

    # Fix bundle targets' 'Signing Certificate' to 'Sign to Run Locally'
    installer.pods_project.targets.each do |target|
        target_is_resource_bundle = target.respond_to?(:product_type) && target.product_type == 'com.apple.product-type.bundle'
      
        if target_is_resource_bundle
            target.build_configurations.each do |config|
                config.build_settings["DEVELOPMENT_TEAM"] = dev_team
            end
        end
    end
end

@penghuili
Copy link

It seems upgrading cocoapods to 1.12.0 fixes the problem for everyone, but my current situation is this:

before upgrading cocoapods, we can't even publish the build from our CI to TestFlight, we always get the ITMS-90129: The bundle uses a bundle name or display name that is already taken. error message.

then we upgraded cocoapds, we can now publish the build from CI to TestFlight, but we will immediately get an email from apple, with exactly the same error message ITMS-90129: The bundle uses a bundle name or display name that is already taken., and the build won't appear in TestFlight.

does anyone have the same problem? or anyone has any idea? thx 🙏

As a follow to this, we figured out the reason for ITMS-90129: The bundle uses a bundle name or display name that is already taken., it is indeed because we used the same bundle name.

For our app, we have each app for each env, like App for prod, App-DEV for dev, App-RC for rc.
And all 3 apps have the same CFBundleName in the info.plist file.
with Xcode 13, this is not a problem, but xcode14 complains with that error message.

so, we changed the Fastfile to update the CFBundleName based on env, and everything started working.

@haniewais
Copy link

haniewais commented Apr 18, 2023

If you have different signing certificates for different schemes and don't need the pods signed, you can leave the Team in Xcode to none with the Automatically manage signing checked by default.

Then add the following config.build_settings... lines to the post_install step in your Pod file, example:

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|

            # disable code signing for pods
            config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
            config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
            config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
        end
    end
end

posted here also:
https://stackoverflow.com/questions/72561696/xcode-14-needs-selected-development-team-for-pod-bundles/76049506#76049506

@Dat-Mobile
Copy link

If you have different signing certificates for different schemes and don't need the pods signed, you can leave the Team in Xcode to none with the Automatically manage signing checked by default.

Then add the following config.build_settings... lines to the post_install step in your Pod file, example:

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|

            # disable code signing for pods
            config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
            config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
            config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
        end
    end
end

posted here also: https://stackoverflow.com/questions/72561696/xcode-14-needs-selected-development-team-for-pod-bundles/76049506#76049506

Even cocoapods 1.12 doesn't work, but this fix works for me

polar133 pushed a commit to klarna/react-native-klarna-inapp-sdk that referenced this issue May 9, 2023
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this issue May 22, 2023
… for pods (facebook#34826)

Summary:
This is inspired by the Expo workaround expo/expo@d970a9e to address an issue that cocoapods has with Xcode 14: CocoaPods/CocoaPods#11402

This wants to address this facebook#34673 in a way that we can also cherry-pick on the 0.70 branch.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[iOS] [Fixed] - add xcode 14 workaround (turn off signing resource bundles) for `React-Core`

Pull Request resolved: facebook#34826

Test Plan:
Tested locally by opening RNTester via Xcode 14.0.1, and targetting my iPhone as device. After applying the patch, the error for React Core AccessibilityResources disappears.

Also, added ruby test for new patch.

Reviewed By: hramos

Differential Revision: D40063828

Pulled By: hramos

fbshipit-source-id: e10d5b6a917a6a7cbacd14ecfdac55e60e46c6f8
Bibazavr added a commit to lad-tech/mobydick that referenced this issue Jul 17, 2023
DaveWoodCom added a commit to DaveWoodCom/XCGLogger that referenced this issue May 5, 2024
…igning framework bundles and for future visionOS support (see CocoaPods/CocoaPods#11402 . Thanks AlamoFire )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.