iOS Central & Peripheral, GATT is never cached?

I'm working on a proof of concept for a piece of hardware which will act as a peripheral to an Apple Watch, and which must reconnect very quickly after disconnects. To build the proof of concept, we're using two iOS devices, running apps which act as the central and the peripheral. I've gotten the reconnection time down fairly low (around 0.25 s) using the practices described in Apple's Core Bluetooth Programming Guide, but the biggest component remaining is service discovery. It appears that the peripheral's service information is never cached on the central device. Each time the central reconnects to the same peripheral, the service and its characteristics need to be re-scanned:


14:52:59.3640 Central: Resetting properties and scanning for known peripheral
14:52:59.3700 Central: Looking for known peripheral 79041F38-72F0-4C86-B556-02A1644F8C99
14:52:59.3700 Central: found known peripheral 79041F38-72F0-4C86-B556-02A1644F8C99 in state disconnected, trying to connect to it
14:53:03.5080 Central: Connected to peripheral 79041F38-72F0-4C86-B556-02A1644F8C99
14:53:03.5090 Central: Peripheral 79041F38-72F0-4C86-B556-02A1644F8C99 had no services
14:53:03.7760 Central: Discovered services for 79041F38-72F0-4C86-B556-02A1644F8C99
14:53:03.7870 Central: Peripheral 79041F38-72F0-4C86-B556-02A1644F8C99's service 19CAB8A1-9AF1-458E-B984-758D1909D7E5 had no characteristics
14:53:03.7870 Central: found matching service, discovering characteristics.
14:53:03.8530 Central: Discovered characteristics for service 19CAB8A1-9AF1-458E-B984-758D1909D7E5 on 79041F38-72F0-4C86-B556-02A1644F8C99
14:53:03.8640 Central: found matching characteristics, stopping discovery
14:53:31.0850 Central: Disconnected from peripheral 79041F38-72F0-4C86-B556-02A1644F8C99
14:53:31.0850 Central: Peripheral disconnection error: Error Domain=CBErrorDomain Code=6 "The connection has timed out unexpectedly." UserInfo={NSLocalizedDescription=The connection has timed out unexpectedly.}
14:53:31.0850 Central: Disconnected from known peripheral
14:53:31.0850 Central: Starting scanning in state Idle
14:53:31.0850 Central: Resetting properties and scanning for known peripheral
14:53:31.0900 Central: Looking for known peripheral 79041F38-72F0-4C86-B556-02A1644F8C99
14:53:31.0910 Central: found known peripheral 79041F38-72F0-4C86-B556-02A1644F8C99 in state disconnected, trying to connect to it
14:53:33.4060 Central: Connected to peripheral 79041F38-72F0-4C86-B556-02A1644F8C99
14:53:33.4070 Central: Peripheral 79041F38-72F0-4C86-B556-02A1644F8C99 had no services
14:53:33.6590 Central: Discovered services for 79041F38-72F0-4C86-B556-02A1644F8C99
14:53:33.6670 Central: Peripheral 79041F38-72F0-4C86-B556-02A1644F8C99's service 19CAB8A1-9AF1-458E-B984-758D1909D7E5 had no characteristics
14:53:33.6670 Central: found matching service, discovering characteristics.
14:53:33.7070 Central: Discovered characteristics for service 19CAB8A1-9AF1-458E-B984-758D1909D7E5 on 79041F38-72F0-4C86-B556-02A1644F8C99
14:53:33.7180 Central: found matching characteristics, stopping discovery

Given other posts in this forum, and elsewhere online, it appears that iOS Central apps communicating with a hardware peripheral apps do get GATT caching.


I've tried setting all my characteristics to require encryption:

    var ingestCharacteristic = CBMutableCharacteristic(type: Constants.ingestCharacteristicUUID, properties: [.writeWithoutResponse, .authenticatedSignedWrites], value: nil, permissions: .writeEncryptionRequired)
    var isLoggingCharacteristic = CBMutableCharacteristic(type: Constants.loggingCharacteristicUUID, properties: [.notify, .notifyEncryptionRequired], value: nil, permissions: .readEncryptionRequired)
    var toggleLoggingCharacteristic = CBMutableCharacteristic(type: Constants.toggleLoggingCharacteristicUUID, properties: [.write, .authenticatedSignedWrites], value: nil, permissions: .writeEncryptionRequired)


Should GATT caching work in this circumstance?