Xamarion.iOS CoreBluetooth BLE 应用程序在 iPhone 10 崩溃

Xamarion.iOS CoreBluetooth BLE app crashes on iPhone 10

重现崩溃的步骤...

  1. Visual Studio Windows 10,搭配 macbook pro
  2. 从 github 下载 wojciech-kulik/Sample-Projects:https://github.com/wojciech-kulik/Sample-Projects
  3. 打开 Sample-Projects-master\Xamarin.iOS\BluetoothTest\bLUETOOTH tEST.SLN
  4. 配对Mac
  5. Select 并在 iPhone 上调试 10 崩溃。 请参阅随附的崩溃输出。

iPhone 已配置并运行我的其他 Xamarin.iOS 应用程序。

已尝试重启所有设备。

崩溃输出...................................... ..................... 加载的程序集:/private/var/containers/Bundle/Application/6BD03353-EB72-4E79-8D3B-F72606BA7DE9/BluetoothTest2.app/System.Drawing.Common.dll [外部] 加载的程序集:/private/var/containers/Bundle/Application/6BD03353-EB72-4E79-8D3B-F72606BA7DE9/BluetoothTest2.app/System.dll [外部] 加载的程序集:/private/var/containers/Bundle/Application/6BD03353-EB72-4E79-8D3B-F72606BA7DE9/BluetoothTest2.app/Xamarin.iOS.dll [外部] 线程开始:#2 加载的程序集:/private/var/containers/Bundle/Application/6BD03353-EB72-4E79-8D3B-F72606BA7DE9/BluetoothTest2.app/System.Core.dll [外部] 加载的程序集:/private/var/containers/Bundle/Application/6BD03353-EB72-4E79-8D3B-F72606BA7DE9/BluetoothTest2.app/BluetoothTest2.exe

============================================= ==================== 本机崩溃报告

执行本机代码时出现中断。这通常表明 单声道运行时或本机库之一中的致命错误 由您的应用程序使用。

============================================= ==================== 本机堆栈跟踪:

0x102ea23a8 - /private/var/containers/Bundle/Application/6BD03353-EB72-4E79-8D3B-F72606BA7DE9/BluetoothTest2.app/libmonosgen-2.0.dylib : mono_dump_native_crash_info
0x102e98620 - /private/var/containers/Bundle/Application/6BD03353-EB72-4E79-8D3B-F72606BA7DE9/BluetoothTest2.app/libmonosgen-2.0.dylib : mono_handle_native_crash
0x102ea18f4 - /private/var/containers/Bundle/Application/6BD03353-EB72-4E79-8D3B-F72606BA7DE9/BluetoothTest2.app/libmonosgen-2.0.dylib : sigabrt_signal_handler
0x19c9aa894 - /usr/lib/system/libsystem_platform.dylib : <redacted>
0x19ca99e58 - /usr/lib/system/libsystem_kernel.dylib : <redacted>
0x19ca99e88 - /usr/lib/The app has been terminated.

system/libsystem_kernel.dylib : 0x1a2f0dc64 - /System/Library/PrivateFrameworks/TCC.framework/TCC : 0x1a2f0dba4 - /System/Library/PrivateFrameworks/TCC.framework/TCC : 0x1a2f11ad8 - /System/Library/PrivateFrameworks/TCC.framework/TCC : 0x19c874b1c - /usr/lib/system/libxpc.dylib : 0x19c8693e8 - /usr/lib/system/libxpc.dylib : 0x19c9675a4 - /usr/lib/system/libdispatch.dylib : 0x19c93e0f8 - /usr/lib/system/libdispatch.dylib : 0x19c94e1c0 - /usr/lib/system/libdispatch.dylib : 0x19c9b8bac - /usr/lib/system/libsystem_pthread.dylib : _pthread_wqthread 0x19c9bb740 - /usr/lib/system/libsystem_pthread.dylib : start_wqthread

============================================= ==================== 基本故障地址报告

本地指令指针(0x19ca957f4)周围的内存:0x19ca957e4 c0 03 5f d6 c0 03 5f d6 30 41 80 d2 01 10 00 d4 ......0A.. .

... 0x19ca957f4 e3 00 00 54 fd 7b bf a9 fd 03 00 91 b4 80 ff 97 ...T.{......... 0x19ca95804 bf 03 00 91 fd 7b c1 a8 c0 03 5f d6 c0 03 5f d6 .....{.......。 0x19ca95814 d0 03 80 d2 01 10 00 d4 e3 00 00 54 fd 7b bf a9 ......... .T.{..

应用已终止。

这是 info.plist 崩溃修复。 (但它随后得到 C# 异常)

    <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleName</key>
    <string>BluetoothTest</string>
    <key>CFBundleIdentifier</key>
    <string>pl.wojciechkulik.BluetoothTest</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleVersion</key>
    <string>1.0</string>
    <key>LSRequiresIPhoneOS</key>
    <true/>
    <key>MinimumOSVersion</key>
    <string>9.3</string>
    <key>UIDeviceFamily</key>
    <array>
        <integer>1</integer>
    </array>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UIMainStoryboardFile</key>
    <string>Main</string>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>armv7</string>
    </array>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>XSAppIconAssets</key>
    <string>Assets.xcassets/AppIcon.appiconset</string>
    <key>UIBackgroundModes</key>
    <array>
        <!--for connecting to devices (client)-->
        <string>bluetooth-central</string>

        <!--for server configurations if needed-->
        <string>bluetooth-peripheral</string>
    </array>

    <!--Description of the Bluetooth request message (required on iOS 10, deprecated)-->
    <key>NSBluetoothPeripheralUsageDescription</key>
    <string>YOUR CUSTOM MESSAGE</string>

    <!--Description of the Bluetooth request message (required on iOS 13)-->
    <key>NSBluetoothAlwaysUsageDescription</key>
    <string>YOUR CUSTOM MESSAGE</string></dict>
</plist>