iOS CoreBluetooth state unsupported when using in iOS custom keyboard

自古美人都是妖i 提交于 2019-12-02 12:10:51

问题


I want to use CoreBluetooth API within iOS keyboard extension (custom keyboard). However, the state for the CBCentralManager is unsupported. The device I use is iPhone 6. It works fine inside the container app. Does this mean that the CoreBluetooth API cannot be used inside the keyboard extension?


回答1:


You will need to set RequestOpenAccess to YES in your extension's plist under NSExtension > NSExtensionAttributes.

Setting this to YES allows the extension to access network resources. Bluetooth is considered a network resource so you will get CBManagerStateUnsupported when RequestOpenAccess is NO.



来源:https://stackoverflow.com/questions/38546815/ios-corebluetooth-state-unsupported-when-using-in-ios-custom-keyboard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!