32

The following error is displayed when attempting to build on an IOS device:
As shown in the picture below, the Signing setting in Xcode is well done.
Can you tell me the cause and solution of this?

Could not build the precompiled application for the device.
Error (Xcode): Signing for "GoogleSignIn-GoogleSignIn" requires a development team. Select a development team in the Signing & Capabilities editor.
/Users/home_1/StudioProjects/Example%20Project/app/ios/Pods/Pods.xcodeproj


Error (Xcode): Signing for "DKPhotoGallery-DKPhotoGallery" requires a development team. Select a development team in the Signing & Capabilities editor.
/Users/home_1/StudioProjects/Example%20Project/app/ios/Pods/Pods.xcodeproj


Error (Xcode): Signing for "DKImagePickerController-DKImagePickerController" requires a development team. Select a development team in the Signing & Capabilities editor.
/Users/home_1/StudioProjects/Example%20Project/app/ios/Pods/Pods.xcodeproj


Error (Xcode): Signing for "gRPC-C++-gRPCCertificates-Cpp" requires a development team. Select a development team in the Signing & Capabilities editor.
/Users/home_1/StudioProjects/Example%20Project/app/ios/Pods/Pods.xcodeproj

enter image description here

Kevin Yang
  • 629
  • 1
  • 5
  • 19

12 Answers12

55

This happened to me today after switching to Xcode 14. Try adding this to your podfile

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if config.build_settings['WRAPPER_EXTENSION'] == 'bundle'
        config.build_settings['DEVELOPMENT_TEAM'] = 'YOUR_DEVELOPMENT_TEAM_ID'
      end
    end
  end
end

Don't forget to replace the YOUR_DEVELOPMENT_TEAM_ID with your actual development Team ID which you can find in developer.apple.com

This will permanently fix the issue.

If you don't want to use the Team ID you can do this instead:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      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
end

If you have other post_install steps, for example flutter_additional_ios_build_settings(target), make sure to keep them

Vahagn Gevorgyan
  • 2,635
  • 19
  • 25
  • 1
    This worked for me but I had to keep this line: flutter_additional_ios_build_settings(target) – Jackson Welch Sep 17 '22 at 22:47
  • 1
    I'd also check out these issues: [issue 1](https://github.com/flutter/flutter/issues/111475) [issue 2](https://github.com/CocoaPods/CocoaPods/issues/11402) – Liel van der Hoeven Sep 18 '22 at 07:40
  • This fixed the issue. What is causing this issue? Is the fix a workaround for an issue with flutter SDK or Xcode? – Justin Sep 18 '22 at 19:23
  • @Justin no it's not a flutter issue, it is related to Xcode. I'm a native(swift) developer myself and I've faced the same issue – Vahagn Gevorgyan Sep 18 '22 at 20:02
  • 1
    I prefer this solution over the others, as this overcame the issue from Apple reviewers where they reject apps that have their pods' code signing skipped by using `CODE_SIGNING_ALLOWED = NO`. – Chen Li Yong Feb 06 '23 at 03:26
13

I'm wondering when Apple is going to launch a new xCode version without breaking anything from previous ones!

Rants aside, this is how I fixed my Flutter project based on previous answers:

Open your awesome_flutter_project/ios/Podfile:

and replace these lines:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

for:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      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
end
Christian
  • 7,062
  • 9
  • 53
  • 79
9

Just for everyone, who thinks the accepted solution is a hack, you are right. This is a known bug in the flutter framework which has been fixed in flutter 3.3.3 .

So I recommand everyone to upgrade to this version, if you are able/allowed to do so.

In case you can't upgrade to 3.3.3 then the accepted solution is your best bet ;)

Christian X
  • 1,919
  • 1
  • 15
  • 21
4

I also got this error after updating XCode to version 14.

Add the following to ios > podfile

enter image description here

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      if config.build_settings['WRAPPER_EXTENSION'] == 'bundle'
        config.build_settings['DEVELOPMENT_TEAM'] = 'YOUR_DEVELOPMENT_TEAM_ID'
      end
    end
  end
end

To get YOUR_DEVELOPMENT_TEAM_ID: https://developer.apple.com/account/#!/membership/

This will permanently fix the issue.

If you don't want to use the Team ID you can do this instead:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      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
end
4

It's a Flutter framework issue

Update Flutter version into 3.3.3

Anand
  • 4,355
  • 2
  • 35
  • 45
1

I was able to solve the problem by doing the following:

  1. Open project on xCode
  2. Open Pods and find out "GoogleSignIn-GoogleSignIn" and other three on Pods > Target
  3. Select Team on Signing & Capabilities
BIS Tech
  • 17,000
  • 12
  • 99
  • 148
1

Open your flutter project in Xcode

Pods -> Targets -> Signing & Capabilities -> Select Team

Select Team for every Targets

enter image description here

Anand
  • 4,355
  • 2
  • 35
  • 45
1

I am using CodeMagic.io (CI/CD) and had this same problem, I found the issue to be the Xcode version: 14

I solved this at CodeMagic.io by doing this :

  1. Go to the Workflow Editor
  2. Go to 'Build'
  3. Change the Xcode version: 13.4.1

If you are using another CI/CD try using Xcode version: 13.4.1

It was mentioned to solve this you can also update your Flutter version to 3.3.3 however if like me this is not an option for you try using Xcode version 13.4.1

Roger
  • 63
  • 1
  • 9
1

adding following code solved issue in Xcode 14 and flutter version 2.8

        config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
A.K.J.94
  • 492
  • 6
  • 14
0

When I put the the suggested changes in the pod file and run the flutter build ipa command, I am getting a different error.

Error:

 In file included from /Volumes/Data/FlutterSDK/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.9.3/ios/Classes/FWFUIViewHostApi.m:5:
/Volumes/Data/FlutterSDK/.pub-cache/hosted/pub.dartlang.org/webview_flutter_wkwebview-2.9.3/ios/Classes/FWFUIViewHostApi.h:5:9: fatal error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
Sam
  • 2,972
  • 6
  • 34
  • 62
0

For CI/CD, this is the only solution that worked for me. Update podfile.

       target_is_resource_bundle = target.respond_to?(:product_type) && target.product_type == 'com.apple.product-type.bundle'
       target.build_configurations.each do |build_configuration|
         if target_is_resource_bundle
           build_configuration.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
           build_configuration.build_settings['CODE_SIGNING_REQUIRED'] = 'NO'
           build_configuration.build_settings['CODE_SIGNING_IDENTITY'] = '-'
           build_configuration.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = '-'
         end
       end
Ares
  • 2,504
  • 19
  • 19
0

enter image description here

then go to the team drop list and select your team