首页 > 解决方案 > Flutter 错误:未找到“xxx”的配置文件:Xcode 找不到任何与“xxx”匹配的 iOS 应用程序开发配置文件

问题描述

我正在尝试在 iPhone 上测试 Flutter 应用程序,但我收到如下所示的错误,此错误发生在构建步骤期间。

error: No profiles for 'xxx' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'xxx'.  Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'Runner' from project 'Runner')

在运行时我面临这个错误

Launching lib/main.dart on Test’s iPhone in debug mode...
Warning: Missing build name (CFBundleShortVersionString).
Warning: Missing build number (CFBundleVersion).
Automatically signing iOS for device deployment using specified development team in Xcode project: FF3XTSVPAA
Action Required: You must set a build name and number in the pubspec.yaml file version field before submitting to the App Store.
Running Xcode build...
Xcode build done.                                            7.1s
Failed to build iOS app
Error output from Xcode build:
↳
    2020-12-07 16:43:22.754 xcodebuild[58078:524500]  DTDeviceKit: deviceType from 49f62dac6f1da634e5d71981db4d591dc9126e4b was NULL
    2020-12-07 16:43:22.848 xcodebuild[58078:524500]  DTDeviceKit: deviceType from 49f62dac6f1da634e5d71981db4d591dc9126e4b was NULL
    2020-12-07 16:43:27.506 XCBBuildService[58089:524662] Failed to remove: /Users/pkimac/Library/Developer/Xcode/DerivedData/Runner-aeyppfmredercraizkomsbeyvogn/Build/Intermediates.noindex/XCBuildData/8a97fdf5f2a949e7c436c417eb175882-desc.xcbuild: unlink(/Users/pkimac/Library/Developer/Xcode/DerivedData/Runner-aeyppfmredercraizkomsbeyvogn/Build/Intermediates.noindex/XCBuildData/8a97fdf5f2a949e7c436c417eb175882-desc.xcbuild): No such file or directory (2)
    ** BUILD FAILED **


Xcode's output:
↳
    note: Using new build system
    note: Planning build
    note: Constructing build description
    error: No profiles for 'com.duytq.flutterchatdemo' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.duytq.flutterchatdemo'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'Runner' from project 'Runner')
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 8.0 to 13.2.99. (in target 'abseil' from project 'Pods')
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 4.3, but the range of supported deployment target versions is 8.0 to 13.2.99. (in target 'nanopb' from project 'Pods')
    warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 8.0 to 13.2.99. (in target 'gRPC-C++-gRPCCertificates-Cpp' from project 'Pods')

Could not build the precompiled application for the device.
Error launching application on Test’s iPhone.

如何制作配置文件?我的应用程序在 iPhone 上运行时应该怎么做?

标签: iosiphonexcodeflutterprovisioning-profile

解决方案


实际上有一些步骤可以解决这个问题:

配置文件是一个二进制文件,可用于在设备上运行应用程序并在开发时使用其服务。要将您的应用程序分发到 App Store,您需要创建分发配置文件以使其获得 Apple 的批准。在这种情况下,您的构建将使用生产网关进行签名。 

要将 Flutter 应用部署到物理 iOS 设备,您需要在 Xcode 和 Apple 开发者帐户中设置物理设备部署。如果您的应用使用 Flutter 插件,您还需要第三方 CocoaPods 依赖管理器。

  1. 打开终端并运行这些命令以安装将 Flutter 应用程序部署到 iOS 设备的工具。通过运行以下命令来安装和设置 CocoaPods :

    sudo gem install cocoapods
    
  2. 按照 Xcode 签名流程配置您的项目:

    一个ios/Runner.xcworkspace通过在 Flutter 项目目录的终端窗口中运行 open 来打开项目中的默认 Xcode 工作区。

    b . 在运行按钮旁边的设备下拉菜单中选择您要部署到的设备。

    cRunner .在左侧导航面板中选择项目。

    d .在 Runner 目标设置页面中,确保选择了您的开发团队。UI 因您的 Xcode 版本而异。

    • 对于 Xcode 11 及更高版本,请查看Signing & Capabilities > Team.

    当您选择一个团队时,Xcode 会创建并下载开发证书,使用您的帐户注册您的设备,并创建和下载配置文件(如果需要)。

    • 要开始您的第一个 iOS 开发项目,您可能需要使用您的 Apple ID 登录 Xcode。

    在此处输入图像描述

    任何 Apple ID 都支持开发和测试。需要注册 Apple Developer Program 才能将您的应用程序分发到 App Store。有关成员资格类型的详细信息,请参阅选择成员资格

    然后,转到 iOS 设备上的“设置”应用,选择General > Device Management并信任您的证书。对于初次使用的用户,您可能需要改为选择General > Profiles > Device Management

    • 如果 Xcode 中的自动签名失败,请验证项目的General > Identity > Bundle Identifier值是否唯一。

    在此处输入图像描述

  3. 通过运行flutter run或单击 Xcode 中的“运行”按钮来启动您的应用程序。

要创建配置文件,请按照 Apple 帮助页面上的说明进行操作。

下载手动配置文件,下载配置文件

有关更多信息,请参阅:https ://flutter.dev/docs/get-started/install/macos#ios-setup


推荐阅读