微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

我的Xamarin.ios BLE示例“如何与iOS上的低功耗蓝牙设备通信”崩溃

如何解决我的Xamarin.ios BLE示例“如何与iOS上的低功耗蓝牙设备通信”崩溃

当我为Xamarin.ios运行Bluetooth Low Energy应用程序的示例代码时,我崩溃了 来自博客“如何与iOS上的低功耗蓝牙设备通信”,网址为: https://wojciechkulik.pl/xamarin-ios/how-to-communicate-with-bluetooth-low-energy-devices-on-ios

enter image description here

他的示例代码的邮政编码位于: https://github.com/wojciech-kulik/Sample-Projects

我唯一改变的想法是,在这里将他推荐的NSBluetoothPeripheralUsageDescription修复添加到我的info.plist中。

<?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>

堆栈跟踪.........

enter image description here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。