问题描述
我需要在我与Macbook配对的Windows Visual Studio上构建的xamarin.ios应用程序中添加低功耗蓝牙(ble)。 xamarin.ios上的BLE需要info.plist中的NSBluetoothPeripheralUsageDescription。
但是,我不知道如何使用Visual Studio中的info.plist GUI来做到这一点。
解决方法
要添加它,我用记事本(或任何文本编辑器)打开了info.plist并插入了行...
NSBluetoothPeripheralUsageDescription
测试我们的设备的BLE
...接近尾声。
示例...
<?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>
,
但是,我不知道如何使用Visual Studio中的info.plist GUI来做到这一点。
有两种方法可以在Visual Studio中为Calendar
添加NSBluetoothPeripheralUsageDescription
。
一个
然后将其添加到info.plist
下,如下所示:
<dict></dict>
另一种方式是通过 Generic Plist Editor 打开的:
然后可以单击 + 按钮以选择 Privacy-Bluetooth Peripheral Usage Description ,然后键入Value。
更多信息可以参考Setting Privacy Keys。