简体   繁体   English

如何在 Windows Visual Studio xamarin.ios 应用程序中将密钥 NSBluetoothPeripheralUsageDescription 添加到 info.plist

[英]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.

相关问题 应用程序被拒绝:缺少Info.plist密钥“NSBluetoothPeripheralUsageDescription”但框架不存在 - App rejected: Missing Info.plist key “NSBluetoothPeripheralUsageDescription” but framework is not present 为什么使用NSBluetoothPeripheralUsageDescription键的“ Info.plist文件中缺少目标字符串”拒绝应用程序? - Why app is rejected with “Missing Purpose String in Info.plist File” for NSBluetoothPeripheralUsageDescription key? iOS中如何在info.plist中添加属性 - How to add properties in info.plist in iOS Visual Studio Cordova缺少Info.plist键 - Visual Studio Cordova Missing Info.plist key Xcode:如何将密钥添加到生成的 Info.plist 文件中(或合并生成的和现有的 Info.plist)? - Xcode: How to add key into generated Info.plist file (or merge generated and existing Info.plist)? 在cordova ios应用程序中将字段添加到info.plist - Add fields to info.plist in cordova ios app 如何在Visual Studio Xamarin.ios设计器中添加同级视图? - How to add a sibling view in Visual Studio Xamarin.ios designer? iOS应用无法读取info.plist - iOS app cannot read info.plist 在您的 Info.plist 中添加一个名为 FacebookClientToken 的键,并在 IOS 中运行 Flutter 应用程序时添加您的客户端令牌作为其值 - Add a key named FacebookClientToken to your Info.plist, and add your client token as its value while running Flutter app in IOS Xamarin iOS 项目 Info.plist 在 App Store 上提交期间出现问题 - Xamarin iOS project Info.plist issues during submission on App Store
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM