IOS - property "isConnected" not found on object of type "CBPeripheral"

I am trying to play an Android application that I have already made for iOS. I'm trying to make a BLE application where my iOS device can see and connect to BLE devices and receive RSSI (I really don't care about the message and other data). When researching the search, I found this BLTE Central Peripheral Transfer Example in the iOS Developer Library. After downloading, open the Xcode project, and then run it. However, I encountered an error with this code:

if (!self.discoveredPeripheral.isConnected) { return; } 

where the error is: Property 'isConnected' not found on object of type 'CBPeripheral'

When searching again, I found this link . However, the thread does not seem to have solutions, as the answers being discussed also seem outdated. I can't seem to find a solution to this problem.

Has anyone tried to make code from the iOS developer library?

+5
source share
2 answers

The documentation states

Resignation letter
Use the state property instead.

+5
source

isConnected out of date, try using this code

 if (self.discoveredPeripheral.state != CBPeripheralStateConnected) { return; } 
+2
source

All Articles