[英]How to add key NSBluetoothPeripheralUsageDescription to info.plist in a Windows Visual Studio xamarin.ios app
I need to add BLUETOOTH LOW ENERGY (ble) to my xamarin.ios app, which I build on windows Visual Studio paired to my Macbook.我需要将 BLUETOOTH LOW ENERGY (ble) 添加到我的 xamarin.ios 应用程序中,该应用程序是在与 Macbook 配对的 Windows Visual Studio 上构建的。 BLE on xamarin.ios requires NSBluetoothPeripheralUsageDescription in info.plist.
xamarin.ios 上的 BLE 需要 info.plist 中的 NSBluetoothPeripheralUsageDescription。
However, I can't figure out how to do it with the info.plist GUI in Visual Studio.但是,我不知道如何使用 Visual Studio 中的 info.plist GUI 来实现。
To add it, I opened info.plist with Notepad (or any text editor) and inserted the lines... NSBluetoothPeripheralUsageDescription要添加它,我用记事本(或任何文本编辑器)打开 info.plist 并插入了几行... NSBluetoothPeripheralUsageDescription
To test our device for BLE测试我们的设备的 BLE
...near the end. ...接近尾声。
Example...例子...
<?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>
However, I can't figure out how to do it with the info.plist GUI in Visual Studio.
但是,我不知道如何使用 Visual Studio 中的 info.plist GUI 来实现。
There are two ways to add NSBluetoothPeripheralUsageDescription
for info.plist
in Visual Studio.有两种方法可以在 Visual Studio 中为
info.plist
添加NSBluetoothPeripheralUsageDescription
。
One is open with XML(Text)Editor一种是用XML(Text)Editor打开
Then add it bellow <dict></dict>
as follows:然后将其添加到
<dict></dict>
如下:
<?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>NSBluetoothPeripheralUsageDescription</key>
<string>Allow NSBluetoothPeripheralUsageDescription </string>
</dict>
</plist>
Another way is open with Generic Plist Editor :另一种方法是使用Generic Plist Editor打开:
Then can click + button to select Privacy - Bluetooth Peripheral Usage Description and type Value .然后可以单击+按钮选择隐私-蓝牙外设使用说明并键入值。
More info can refer to Setting Privacy Keys .更多信息可以参考设置隐私密钥。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.