Hassy
Hassy

Reputation: 5208

Xcode 14 - Cannot code sign because the target does not have an Info.plist file

I am using cocoapods in my project and it was working fine but after upgrade to Xcode 14 it is giving different kind or errors.

Firstly it was asking for bit code and later asked for the development team which I resolved using following script in podfile

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      #config.build_settings['BITCODE_GENERATION_MODE'] = 'bitcode'
      config.build_settings['ENABLE_BITCODE'] = 'YES'
      config.build_settings["DEVELOPMENT_TEAM"] = " Your Team ID "
    end
  end
end

After resolving those error another one has started to appear i.e.

error build: 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).

my pods are updated and cocoa pod version is 1.11.3. How can i resolve this error?

EDIT:

Some details are mentioned here but none is working for me.

Upvotes: 18

Views: 29206

Answers (7)

Neelesh Yadav
Neelesh Yadav

Reputation: 21

post_install do |installer|
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false,
    )
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        # Ensure the GENERATE_INFOPLIST_FILE is set to YES for targets missing Info.plist
        config.build_settings['GENERATE_INFOPLIST_FILE'] = 'YES'
        config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
        config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', '_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION']
      end
    end
  end

This works for me

Upvotes: 1

technoplato
technoplato

Reputation: 3421

Since we don't have our Pods.xcproject tracked in git, I decided to make the modification that others are suggesting via the Podfile, since it is checked in.

  post_install do |installer|
    
    installer.generated_projects.each do |project|
      if project.path.basename.to_s == 'Pods.xcodeproj'
        project.build_configurations.each do |config|
          config.build_settings['GENERATE_INFOPLIST_FILE'] = 'YES'
        end
        project.save
      else
        puts "Skipping project #{project.path.basename}"
      end
    end
  end # post_install

This does the same thing as manually setting that value in the Xcode GUI, but makes it so that any time you do another pod install, you'll still get the setting you need.

Upvotes: 2

MarkHu
MarkHu

Reputation: 1849

Sometimes a picture clarifies things that are hard to describe in words. You can enable "Generate Info.plist File" for both Debug and Release, under the Build Settings, Packaging.

enable Generate Info.plist file for both Debug and Release

Upvotes: 7

Engr.Aftab Ufaq
Engr.Aftab Ufaq

Reputation: 6212

All the above solution not worked for me. the final solution that had worked for me is that. Pod -> Build Setting -> Generate Info.plist to NO And React-Codegen to YES

Upvotes: 0

I Solved it making this change:

Pods -> Build Settings -> Packaging -> Generate Info.plist File = Yes

Upvotes: 40

fabio
fabio

Reputation: 63

In my case I solved it adding the Info.plist path to: Pods -> Build Settings -> Packaging -> Info.plist File

Upvotes: 4

gopal.iosdev
gopal.iosdev

Reputation: 77

This hack(i.e. setting CODE_SIGNING_ALLOWED to NO for pod's build setting) fixed for me.

Upvotes: 6

Related Questions