我设法在前台成功连接并与外围设备配对。但是当我尝试从后台连接时,外围设备会连接,然后立即断开连接并出现以下错误:
BTServer[67] <Error>: LE pairing failed to device "F90..." with result 1
BTServer[67] <Error>: ATT no characteristic values with UUID 0x2A00 could be read in range [0x0001, 0x0007] on device "F90..."
BTServer[67] <Error>: Aborting command as device "F90..." is no longer connected
这看起来很奇怪,因为外围设备已经配对,当应用程序在前台时就不会发生这种情况了。
这仅在iOS 8上发生。在iOS 7上,相同的代码在后台和前台模式下均可正常工作。