• Hey everyone,

    Really enjoying getting back into working with my Puck.js v 2.0b Firmware 2v14

    I'm trying to get the Puck to notify my iOS app (Xcode 13.4), and I am able to find and connect to the Puck, discover the services and custom characteristic, but when I try to setNotifyValue(true, for: customCharacteristic) I get the following error and notifications are clearly do not work when I press the button:

    ERROR updating notification state error=Error Domain=CBATTErrorDomain Code=6 "The request is not supported." UserInfo={NSLocalizedDescription=The request is not supported.}
    

    The Puck.js code I am using is from the documentation:

    var count = 0;
    
    NRF.setServices({
      0xBCDE : {
        0xABCD : {
          value: "Hello",
          maxLen : 20,
          notify: true
        },
      }
    });
    
    setWatch(function() {
      count = count + 1;
      NRF.updateServices({
        0xBCDE : {
          0xABCD : {
            value : "World "+count+"!",
            notify: true
          }
        }
      });
    }, BTN, { repeat:true, edge:"rising", debounce: 50 });
    

    Appreciate any guidance.
    Thanks,
    Narath

  • Update: I added additional code on the iOS side to check the characteristic, and it reports only:

    Properties CBCharacteristicProperties(rawValue: 2)
    read
    
  • Okay - got it solved! It was due to the iOS Bluetooth caching. Since I had connected to the device at some point, it cached the initial service and characteristics (which were only read). I did try turning Bluetooth off at the swipe down menu but this apparently did not clear it.

    To clear the iOS bluetooth cache I do this:

    • settings > Bluetooth > Turn off - wait a bit, turn back on

    This did the trick, and now setting notify works correctly, and I get notifications! Woot - go espruino!

  • Okay - got it solved! It was due to the iOS Bluetooth caching

    Great! Thanks for letting us know!

    I'm afraid this does seem to be a common issue when developing Bluetooth devices with iOS :)

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

iOS Notifications Error - Puck.js - Solved (clear your iOS bluetooth cache when you update your services)

Posted by Avatar for narath @narath

Actions