问题
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