Flutter IOS 构建错误 - “在签名和功能编辑器中选择开发团队。”

Kev*_*ang 32 ios flutter

尝试在 IOS 设备上构建时显示以下错误:
如下图所示,Xcode 中的 Signing 设置做得很好。
您能告诉我这个问题的原因和解决方法吗?

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
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

Vah*_*yan 56

今天切换到 Xcode 14 后发生了这种情况。尝试将其添加到您的 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
Run Code Online (Sandbox Code Playgroud)

不要忘记将 替换YOUR_DEVELOPMENT_TEAM_ID为您的实际开发团队 ID,您可以在developer.apple.com中找到该ID

这将永久解决该问题。

如果您不想使用团队 ID,可以这样做:

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
Run Code Online (Sandbox Code Playgroud)

post_install例如,如果您还有其他步骤flutter_additional_ios_build_settings(target),请确保保留它们


Chr*_*ian 14

我想知道 Apple 何时会推出新的 xCode 版本而不破坏之前版本的任何内容!

撇开咆哮不谈,这就是我根据之前的答案修复Flutter项目的方法:

打开您的 Awesome_flutter_project/ios/Podfile:

并替换这些行:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end
Run Code Online (Sandbox Code Playgroud)

为了:

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
Run Code Online (Sandbox Code Playgroud)


Chr*_*n X 9

对于每个认为公认的解决方案是黑客的人来说,你是对的。这是 flutter 框架中的一个已知错误,已在 flutter 3.3.3 中修复。

因此,如果您能够/允许的话,我建议大家升级到此版本。

如果您无法升级到 3.3.3,那么接受的解决方案是您最好的选择;)


Ana*_*nan 5

这是一个Flutter framework问题

Flutter将版本更新为3.3.3