我试图在我的 iPhone 上编译并安装我正在为 iOS 开发的应用程序,一切都很好,直到某个时候 XCode 开始给我带来问题,我附上详细信息:
Details
Unable to install "Runner"
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402653081
Recovery Suggestion: Please check your project settings and ensure that a valid product has been built.
--
There was an internal API error.
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402653081
User Info: {
DVTRadarComponentKey = 261622;
MobileDeviceErrorCode = "(0xE8000067)";
"com.apple.dtdevicekit.stacktrace" = (
0 DTDeviceKitBase 0x000000011e735e98 DTDKCreateNSErrorFromAMDErrorCode + 272
1 DTDeviceKitBase 0x000000011e771898 __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 160
2 DVTFoundation 0x000000010523f670 DVTInvokeWithStrongOwnership + 76
3 DTDeviceKitBase 0x000000011e7715e4 -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1316
4 IDEiOSSupportCore 0x000000011e5ebd40 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.294 + 2928
5 DVTFoundation 0x00000001053687fc __DVT_CALLING_CLIENT_BLOCK__ + 16
6 DVTFoundation 0x000000010536a220 __DVTDispatchAsync_block_invoke + 680
7 libdispatch.dylib 0x000000019592e128 _dispatch_call_block_and_release + 32
8 libdispatch.dylib 0x000000019592fec0 _dispatch_client_callout + 20
9 libdispatch.dylib 0x00000001959376a8 _dispatch_lane_serial_drain + 620
10 libdispatch.dylib 0x00000001959382a4 _dispatch_lane_invoke + 404
11 libdispatch.dylib 0x0000000195942b74 _dispatch_workloop_worker_thread + 764
12 libsystem_pthread.dylib 0x0000000195adb89c _pthread_wqthread + 276
13 libsystem_pthread.dylib 0x0000000195ada5d4 start_wqthread + 8
);
}
--
System Information
macOS Version 11.5.2 (Build 20G95)
Xcode 12.5.1 (18212) (Build 12E507)
Timestamp: 2021-08-21T02:59:59+02:00
我还附上了 Android Studio IDE 告诉我的内容:
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- Make sure a 'Development Team' is selected under Signing & Capabilities > Team.
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.dev/setup/#deploy-to-ios-devices
Or run on an iOS simulator without code signing
════════════════════════════════════════════════════════════════════════════════
Could not run build/ios/iphoneos/Runner.app on 00008101-001C09912180001E.
Try launching Xcode and selecting "Product > Run" to fix the problem:
open ios/Runner.xcworkspace
Error launching application on iPhone.
在 xCode -> 首选项 -> 帐户 我拥有在 Apple 开发者门户中注册的帐户,我还在 Runner -> 签名和功能 以及 Bundler 标识符
中安排了团队我遇到了同样的问题,我怀疑您发生的情况是您的构建成功,但无法在您的设备上安装。
Xcode
Domain: com.apple.dt.MobileDeviceErrorDomain
报告的问题不准确。对我来说,事实证明我为我的目标扩展之一创建的配置文件已过期。我不知道为什么当我有一个带有过期配置文件的扩展时 Xcode 甚至允许我编译我的包 - 我想它只是看到了主目标的配置配置文件和签名并为扩展目标缓存了它 - 我不知道。但我可以始终如一地重现这一点。
删除扩展并清除旧的 Xcode 版本和缓存后,我的版本安装成功。我什至可以创建一个新的目标扩展并稍后将所有内容添加回来。
尝试在模拟器上运行,而不是在物理设备上运行,以确保除了配置文件和代码签名之外没有其他问题。
尝试为每个目标手动分配团队和配置文件,而不是 Xcode 自动为您设置。
从您的 Apple 开发者帐户验证您的配置文件、开发团队、签名证书此处
清除 Xcode 缓存(产品 → 清理)。由于您使用的是 Flutter,因此还要从 /builds/ios 中删除 iOS 版本。
尝试这个步骤。
备份
ios
文件夹
删除
ios
文件夹
输入此命令
flutter create .