Flutter run出现No Provisioning Profile was found for your project‘s Bundle Identifier or your device

出现场景

在Flutter中,使用flutter run运行debug模式, 等待xcode build完成后,在install时出现以下错误。

Launching lib/main.dart on iPhone in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: DD2AWWF43G
Running Xcode build...
Xcode build done.                                           85.0s
Installing and launching...
No Provisioning Profile was found for your project's Bundle Identifier or your 
device. You can create a new Provisioning Profile for your project in Xcode for 
your team by:
  1- Open the Flutter project's Xcode target with
       open ios/Runner.xcworkspace
  2- Select the 'Runner' project in the navigator then the 'Runner' target
     in the project settings
  3- In the 'General' tab, make sure a 'Development Team' is selected. 
     You may need to:
         - Log in with your Apple ID in Xcode first
         - Ensure you have a valid unique Bundle ID
         - Register your device with your Apple Developer Account
         - Let Xcode automatically provision a profile for your app
  4- Build or run your project again

It's also possible that a previously installed app with the same Bundle 
Identifier was signed with a different certificate.

For more information, please visit:
  https://flutter.io/setup/#deploy-to-ios-devices

Or run on an iOS simulator without code signing
════════════════════════════════════════════════════════════════════════════════
2020-01-09 10:18:45.163 ios-deploy[43201:5238881] [ !! ] Error 0xe8008015: A valid provisioning profile for this executable was not found. AMDeviceSecureInstallApplication(0, device, url, options, install_callback, 0)
Could not install build/ios/iphoneos/Runner.app on 2fd298b64f27b47f0917050a9f7ec70cdc98f033.
Try launching Xcode and selecting "Product > Run" to fix the problem:
 open ios/Runner.xcworkspace

解决方案

错误报的是证书不对。
按照提示,用xcode打开ios/Runner.xcworkspace,检查了签名设置都是正常的,使用xcode 直接run是能正常运行起来的,只是使用flutter run无法正常运行。所以应该是Flutter中有签名缓存,导致打包时使用的以前的签名。

  1. flutter clean
    在flutter项目目录中,使用flutter clean清理缓存.
  2. xcode clean build
    使用xcode打开ios目录,选择菜单栏中的Product->Clean Build Folder.
    在这里插入图片描述
    clean完成后,会出现以下提示
    在这里插入图片描述
  3. flutter build bundle
    最后在flutter项目目录下运行flutter build bundle,重新生成ios app的二进制文件。

再次运行flutter run, 就能正常运行了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值