iOS真机调试签名报错:找不到匹配的Provisioning Profile
iOS真机调试报错:No profiles for 'com.example.myApp' were found 解决方法
模拟器可正常运行iOS应用,但通过IDE(非Xcode直接启动)进行真机调试时触发签名报错,Xcode中签名设置、Provisioning Profile均配置正确,全模式(含Release)已开启自动签名,直接在Xcode中运行或执行
Product > Build均正常。报错信息如下:Failed to build iOS app Could not build the precompiled application for the device. Error (Xcode): No profiles for 'com.example.myApp' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.example.myApp'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. /Users/myName/Desktop/my_app/ios/Runner.xcodeproj 2 It appears that there was a problem signing your application prior to installation on the device. Verify that the Bundle Identifier in your project is your signing id in Xcode open ios/Runner.xcworkspace Also try selecting 'Product > Build' to fix the problem.
解决方案
1. 给IDE的xcodebuild命令添加-allowProvisioningUpdates参数
不同IDE的设置方式不同,以Flutter开发常用IDE为例:
VS Code:
打开项目根目录下的.vscode/launch.json文件,在configurations数组的对应配置中,给args添加构建参数:{ "version": "0.2.0", "configurations": [ { "name": "Flutter", "request": "launch", "type": "dart", "args": [ "--dart-define=XCODE_BUILD_FLAGS=-allowProvisioningUpdates" ] } ] }如果有flavor配置,可在
args中一并添加(如"--flavor", "dev")。Android Studio/IntelliJ:
打开Run > Edit Configurations,找到你的Flutter运行配置,在Additional run args输入框中添加:--dart-define=XCODE_BUILD_FLAGS=-allowProvisioningUpdates
2. 重新触发Xcode自动签名验证
虽然已开启自动签名,可手动重新触发一次权限同步:
- 打开
ios/Runner.xcworkspace,选中项目Target,进入Signing & Capabilities标签页 - 先关闭Automatically manage signing,等待几秒后重新打开,选择你的Apple开发者账号
- 等待Xcode重新生成Provisioning Profile,直到状态栏显示"Provisioning profile is up to date"
3. 清理构建缓存后重试
缓存冲突也可能导致签名异常,执行以下命令清理:
flutter clean cd ios pod deintegrate pod install cd .. flutter pub get
同时在Xcode中执行Product > Clean Build Folder(快捷键Cmd+Shift+K),之后再尝试IDE真机调试。
4. 确认IDE的Xcode路径配置
确保IDE使用的是你配置好签名的Xcode版本:
- VS Code:打开设置(快捷键
Cmd+,),搜索Flutter: Xcode Path,确认路径指向正确的Xcode应用(如/Applications/Xcode.app) - Android Studio:打开
Preferences > Languages & Frameworks > Flutter > iOS,检查Xcode路径是否正确
内容的提问来源于stack exchange,提问作者Harvey Jones
相关产品推荐
相关产品推荐

