当尝试在iOS 12及以下版本中启动Xamarin应用程序时,如何修复“错误HE0042”?

7

在尝试在iOS 12及以下版本上启动Xamarin.iOS应用程序时,我遇到了以下错误(iOS 13及以上版本可以正常启动应用程序):

调试输出:

error HE0042: Could not launch the app 'com.companyname.App1' on the device 'iOS 12.2 (16E226) - iPhone 8 Plus': The request to open "com.companyname.App1" failed.

模拟器系统日志

com.apple.CoreSimulator.SimDevice.B80099F4-F084-4872-A08A-87BD762045BF[2469] (UIKitApplication:com.companyname.App1[0x3536][2491][3415]): removing service since it exited with consistent failure - OS_REASON_EXEC

即使是使用VS for Mac或Rider生成的新应用程序,也会出现此错误。
我尝试过以下方法,但都没有结果:
- 在模拟器中擦除所有内容和设置 (https://forums.xamarin.com/discussion/65978/debugger-wont-start-app-on-ios-device) - 重新安装CoreSimulator (Xamarin.iOS: Cannot run after Visual Studio 2019 Update) - 清理项目,删除bin和obj文件夹并重建项目
是否有人遇到同样的问题,该怎么解决?
谢谢!

1
这里有一个类似的问题 https://github.com/xamarin/xamarin-macios/issues/7711#issuecomment-580601147 ,你可以查看Jon的解决方案。 - Lucas Zhang
2个回答

2
在 Visual Studio 中的 iOS 项目属性下的 'iOS Build' 中,我勾选了 'Use the concurrent garbage collector'。这在我的情况下解决了问题。

0
这也发生在我调试 iPhone 模拟器构建时。对我来说,解决方法是将项目的 iOS Bundle Signing -> Custom Entitlements 设置为 Entitlements.plist。这将强制应用程序被签名。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接