Post

Replies

Boosts

Views

Activity

Bluetooth App built in UIKIT is unable to read data from connected peripheral but it equivalent in swiftui works fine.
I am developing an ios Bluetooth app with Swift and UIKIT, The app scans for a specific Bluetooth service and connects to it. Once the connection is established, I discover the services and characteristics of the connected peripheral. The peripheral has two characteristics. One for writing to the peripheral and the other for notifying and reading data from the device. Writing to the peripheral works fine but reading from the device gives the error shown below. Error Domain=CBATTErrorDomain Code=2 "Reading is not permitted." UserInfo={NSLocalizedDescription=Reading is not permitted.} But I have the same app developed in swift and SwiftUI and both writing and reading work fine with the same peripheral connected. Can anyone please explain to me why this is happening? Thank you
1
0
685
Jun ’22