我创建了一个 iOS 应用程序来搜索最近的蓝牙设备。但是当我在 iPhone 上运行这个应用程序时,出现以下错误
[CoreBluetooth] API MISUSE:只能在开机状态下接受此命令
我该如何解决此错误?为什么应用程序中会出现此错误?提前致谢
func centralManagerDidUpdateState(_ central: CBCentralManager) {
print(central.state)
switch (central.state) {
case CBManagerState.poweredOff:
print("CoreBluetooth BLE hardware is powered off")
break;
case CBManagerState.unauthorized:
print("CoreBluetooth BLE state is unauthorized")
break
case CBManagerState.unknown:
print("CoreBluetooth BLE state is unknown");
break
case CBManagerState.poweredOn:
print("CoreBluetooth BLE hardware is powered on and ready")
bluetoothAvailable = true;
break;
case CBManagerState.resetting:
print("CoreBluetooth BLE hardware is resetting")
break;
case CBManagerState.unsupported:
print("CoreBluetooth BLE hardware is unsupported on this platform");
break
}
if bluetoothAvailable == …Run Code Online (Sandbox Code Playgroud) 我正在使用swift项目,它使用Xcode 9和swift 4.1.我创建了一个导航视图控制器,然后创建了其他视图控制器并附加了导航视图控制器.
所以我默认有页眉和页脚.所以我有两个问题,
现在我想要更改除白色之外的页脚颜色,但是当我为其编写任何代码时,它会在页脚后面缩小,我看不到任何没有白色的颜色.我如何为页脚添加任何颜色?
如果我无法为页脚赋予颜色,那么我想使用波纹管代码隐藏该页脚
override func viewWillAppear(animated: Bool)
{
self.navigationController?.navigationBarHidden = true
}
Run Code Online (Sandbox Code Playgroud)但是通过这种颜色,我只能隐藏页眉而不是页脚.所以我如何使用代码隐藏页脚,所以我创建了自定义页脚我想要的.
如何在swift 4.1中解决上述问题?