AnsweredAssumed Answered

CBATTError Writing is not enabled for Alexa MCU on iOS devices

Question asked by Anonymous Member on Mar 26, 2020
Latest reply on Mar 29, 2020 by Sabina Bruce

I am trying to provision the Alexa MCU peripheral with the WiFi credentials so it's able to connect to a WiFi network automatically. I've tried the app that is currently live in the App Store (version 1.4.8) but crashes when I try to start the BLE provision.


I've also used the Swift sample code (version 1.4.3) with no result and there are some issues when it crashes as it's trying to force unwrap an optional with a nil value inside. 


This is replicable using the provided Swift code sample (version 1.4.3) when trying to write the JSON value to the MCU.


I have successfully connected an iPhone to the MCU via Bluetooth and when I am writing the value I get the next error.

Error Domain=CBATTErrorDomain Code=3 "Writing is not permitted." UserInfo={NSLocalizedDescription=Writing is not permitted.}


The discovered CBCharacteristicProperties are the mask of the read (2) and write (8) properties so the discovered properties in the debugging console are shown as:

po service.characteristics!.uuid


po service.characteristics!.properties

    ▿ CBCharacteristicProperties - rawValue : 10

I should be able to write anything into the device as I have received the correct permissions. Whenever I try to do this in the didDiscoverCharacteristicsFor delegate method I get the previous CBATTError not letting me write anything to the device.

Code Sample

However, I am able to read values from the MCU and the problem only shows when writing the value.


Just in case I have tried another app like LightBlue to write a sample value and connecting to the MCU in the console using the screen command to see if any error comes up but nothing shows up. 


The tests have been done on the MCU running version 1.0.10 Apptype: AppA and on two iPhones: X (iOS 13.4) and 6S (iOS 13.3.1) and in both cases the same error prevents writing. 


The Android app is working correctly and writes the JSON to the device without a problem. This has to be an iOS error I am not seeing with CoreBluetooth.