无法调试在 Xamarin.Forms 中制作的 IOS 应用程序

Posted

技术标签:

【中文标题】无法调试在 Xamarin.Forms 中制作的 IOS 应用程序【英文标题】:Cannot Debug IOS app made in Xamarin.Forms 【发布时间】:2021-11-12 16:14:24 【问题描述】:

这是我第一次使用 Xamarin.Forms 开发移动应用程序。 我已经尝试了几天来解决这个问题,但我无法弄清楚。

基本上,我正在尝试在我的 iPhone 上调试应用程序,它成功构建并安装在手机上,但是当我运行应用程序时(根据调试器的要求),它只显示启动画面,然后它崩溃(超过 5 秒后)。 检查调试控制台,我发现这个错误:

2021-09-17 22:14:04.323 Xamarin.PreBuilt.ios[1911:423723] Xamarin.iOS: Successfully received USB connection from the IDE on port 10000, fd: 6

2021-09-17 22:14:04.331 Xamarin.PreBuilt.iOS[1911:423723] Xamarin.iOS: Processing: 'start profiler: no'

2021-09-17 22:14:04.332 Xamarin.PreBuilt.iOS[1911:423719] Xamarin.iOS: Profiler not loaded (disabled)

Loaded assembly: /private/var/containers/Bundle/Application/5ED8EF08-A25E-4025-AF71-83D55AEA145F/mvfit.iOS.app/Xamarin.iOS.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/5ED8EF08-A25E-4025-AF71-83D55AEA145F/mvfit.iOS.app/System.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/5ED8EF08-A25E-4025-AF71-83D55AEA145F/mvfit.iOS.app/Mono.Security.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/5ED8EF08-A25E-4025-AF71-83D55AEA145F/mvfit.iOS.app/Xamarin.PreBuilt.iOS.exe [External]
Thread started:  #2
Loaded assembly: /private/var/containers/Bundle/Application/5ED8EF08-A25E-4025-AF71-83D55AEA145F/mvfit.iOS.app/Xamarin.iOS.HotRestart.Application.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/5ED8EF08-A25E-4025-AF71-83D55AEA145F/mvfit.iOS.app/netstandard.dll [External]
Loaded assembly: /private/var/containers/Bundle/Application/5ED8EF08-A25E-4025-AF71-83D55AEA145F/mvfit.iOS.app/System.Core.dll [External]
2021-09-17 22:14:05.060 Xamarin.PreBuilt.iOS[1911:423719] Content folder: /var/mobile/Containers/Data/Application/9F20DC06-5BAB-43F1-BD66-D480944CAAEE/Documents/mvfit.iOS.content

Thread started:  #3
2021-09-17 22:14:05.075 Xamarin.PreBuilt.iOS[1911:423719] Forms app path /var/mobile/Containers/Data/Application/9F20DC06-5BAB-43F1-BD66-D480944CAAEE/Documents/mvfit.iOS.content/mvfit.iOS.exe

Loaded assembly: /private/var/mobile/Containers/Data/Application/9F20DC06-5BAB-43F1-BD66-D480944CAAEE/Documents/mvfit.iOS.content/mvfit.iOS.exe
2021-09-17 22:14:05.077 Xamarin.PreBuilt.iOS[1911:423719] Xamarin.iOS: Unable to locate assembly 'Xamarin.Forms.Platform.iOS' (culture: '')
2021-09-17 22:14:05.077 Xamarin.PreBuilt.iOS[1911:423719] Xamarin.iOS: Unable to locate assembly 'Xamarin.Forms.Platform.iOS' (culture: '')

2021-09-17 22:14:05.081 Xamarin.PreBuilt.iOS[1911:423719] Xamarin.iOS: Unable to locate assembly 'mvfit' (culture: '')
2021-09-17 22:14:05.081 Xamarin.PreBuilt.iOS[1911:423719] Xamarin.iOS: Unable to locate assembly 'mvfit' (culture: '')

Loaded assembly: /private/var/mobile/Containers/Data/Application/9F20DC06-5BAB-43F1-BD66-D480944CAAEE/Documents/mvfit.iOS.content/Xamarin.Forms.Platform.iOS.dll [External]
Loaded assembly: /private/var/mobile/Containers/Data/Application/9F20DC06-5BAB-43F1-BD66-D480944CAAEE/Documents/mvfit.iOS.content/mvfit.dll
2021-09-17 22:14:05.115 Xamarin.PreBuilt.iOS[1911:423719] Xamarin.Forms AppDelegate name: AppDelegate


=================================================================
    Native Crash Reporting
=================================================================
Got a segv while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

=================================================================
    Native stacktrace:
=================================================================

    0x1042e009c - /private/var/containers/Bundle/Application/5ED8EF08-A25E-4025-AF71-83D55AEA145F/mvfit.iOS.app/Xamarin.PreBuilt.iOS : mono_dump_native_crash_info
    0x1042d6bdc - /private/var/containers/Bundle/Application/5ED8EF08-A25E-4025-AF71-83D55AEA145F/mvfit.iOS.app/Xamarin.PreBuilt.iOS : mono_handle_native_crash

    0x1042e39b8 - /private/var/containers/Bundle/Application/5ED8EF08-A25E-4025-AF71-83D55AEA145F/mvfit.iOS.app/Xamarin.PreBuilt.iOS : mono_sigsegv_signal_handler_debug
    0x1e6bf429c - /usr/lib/system/libsystem_platform.dylib : <redacted>
    0x1afa77660 - /usr/lib/libobjc.A.dylib : <redacted>
    0x19ab773b4 - /usr/lib/system/libdyld.dylib : <redacted>
    0x19ab67948 - /usr/lib/system/libdyld.dylib : <redacted>
    0x19ab77f30 - /usr/lib/system/libdyld.dylib : <redacted>
    0x19ab779c0 - /usr/lib/system/libdyld.dylib : <redacted>
    0x19ab79928 - /usr/lib/system/libdyld.dylib : <redacted>
    0x19ab6aecc - /usr/lib/system/libdyld.dylib : <redacted>
    0x10448a4d4 - /private/var/containers/Bundle/Application/5ED8EF08-A25E-4025-AF71-83D55AEA145F/mvfit.iOS.app/Xamarin.PreBuilt.iOS : do_icall
    0x104488b94 - /private/var/containers/Bundle/Application/5ED8EF08-A25E-4025-AF71-83D55AEA145F/mvfit.iOS.app/Xamarin.PreBuilt.iOS : do_icall_wrapper
    0x10447fa88 - /private/var/containers/Bundle/Application/5ED8EF08-A25E-4025-AF71-83D55AEA145F/mvf
it.iOS.app/Xamarin.PreBuilt.iOS : interp_exec_method_full
    0x10447e018 - /private/var/containers/Bundle/Application/5ED8EF08-A25E-4025-AF71-83D55AEA145F/mvfit.iOS.app/Xamarin.PreBuilt.iOS : interp_runtime_invoke
    0x1042e6c70 - /private/var/containers/Bundle/Application/5ED8EF08-A25E-4025-AF71-83D55AEA145F/mvfit.iOS.app/Xamarin.PreBuilt.iOS : mono_jit_runtime_invoke
    0x1043937a8 - /private/var/containers/Bundle/Application/5ED8EF08-A25E-4025-AF71-83D55AEA145F/mvfit.iOS.app/Xamarin.PreBuilt.iOS : mono_runtime_invoke_checked
    0x104398b54 - /private/var/containers/Bundle/Application/5ED8EF08-A25E-4025-AF71-83D55AEA145F/mvfit.iOS.app/Xamarin.PreBuilt.iOS : mono_runtime_exec_main_checked

    0x1042cb7d8 - /private/var/containers/Bundle/Application/5ED8EF08-A25E-4025-AF71-83D55AEA145F/mvfit.iOS.app/Xamarin.PreBuilt.iOS : mono_jit_exec
    0x10447c0f8 - /private/var/containers/Bundle/Application/5ED8EF08-A25E-4025-AF71-83D55AEA145F/mvfit.iOS.app/Xamarin.PreBuilt.iOS : xamarin_main

    0x104292944 - /private/var/containers/Bundle/Application/5ED8EF08-A25E-4025-AF71-83D55AEA145F/mvfit.iOS.app/Xamarin.PreBuilt.iOS : main
    0x19ab65cf8 - /usr/lib/system/libdyld.dylib : <redacted>

=================================================================
    Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x10d85fe88):0x10d85fe78  f6 57 c3 a8 c0 03 5f d6 00 08 40 f9 c0 03 5f d6  .W...._...@..._.
0x10d85fe88  f4 4f be a9 fd 7b 01 a9 fd 43 00 91 1f 20 03 d5  .O...
...C... ..
0x10d85fe98  08 0d 02 58 00 01 40 fd 1f 20 03 d5 21 fb 00 5c  ..
.X..@.. ..!..\
0x10d85fea8  00 20 61 1e 65 02 00 54 e0 e7 01 30 1f 20 03 d5  . a.e..T...0. ..

=================================================================
    Managed Stacktrace:
=================================================================
      at <unknown> <0xffffffff>
      at ObjCRuntime.Dlfcn:_dlopen <0x00026>
      at ObjCRuntime.Dlfcn:dlopen <0x00010>
      at ObjCRuntime.Dlfcn:dlopen <0x00010>
      at <>c:<Main>b__0_0 <0x0000c>
      at System.Action`1:invoke_void_T <0x0007c>
      at Xamarin.iOS.HotRestart.Application:LoadFrameworks <0x00072>
      at Xamarin.iOS.HotRestart.Application:Run <0x0018e>
      at Xamarin.PreBuilt.iOS.Applications:Main <0x0005a>
      at <Module>:runtime_invoke_direct_void_string[] <0x00092>
=================================================================

Thread started: <Thread Pool> #4
Thread started: <Thread Pool> #5
Thread started: <Thread Pool> #6
Thread started: <Thread Pool> #7
L'app è stata terminata.

我正在使用 Visual Studio 16.11.3、Windows 10,并且我有一个有效的付费 Apple 开发者帐户。

【问题讨论】:

【参考方案1】:

根据vscommunity中的这个question,好像是版本相关的问题,所以你可能需要升级你的visual studio再试一次。

【讨论】:

【参考方案2】:

当我在 ios 项目中删除 Xamarin.Forms.Visual.Material 时,它起作用了。

【讨论】:

你从哪里删除了这个程序集。我在我的 ios 项目中找不到 那你的项目里没有

以上是关于无法调试在 Xamarin.Forms 中制作的 IOS 应用程序的主要内容,如果未能解决你的问题,请参考以下文章

更改 Xamarin.Forms 项目代码后,我无法在 Iphone 上进行调试

Xamarin.Forms 调试

如何在 Xamarin.Forms.UITesting 中触发/调试后门功能?

Xamarin Forms iOS 在唤醒时冻结

Xamarin Forms 如何制作可拖动的列表视图

我们可以在 xamarin.forms 中制作可滚动的底部标签页吗