I have successfully managed to get my iOS app (peripheral) send messages to my OSX app (central).

I am now having problems when trying to have the Central update a characteristics value and read it from the Peripheral.

If I change CBCharacteristicProperties to anything other than Notify, my central fails to subscribe to the characteristic with the following error: "Writing is not permitted."

self.transferCharacteristic = CBMutableCharacteristic(type: CBUUID.UUIDWithString(TRANSFER_CHARACTERISTIC_UUID), properties: CBCharacteristicProperties.Read, value: nil, permissions: CBAttributePermissions.Writeable)

To my understanding, in order to have to Central write to the Peripheral, I should use a combination of the line above in the Peripheral, with this event:

func peripheralManager(peripheral: CBPeripheralManager!, didReceiveWriteRequests requests: [AnyObject]!) {}

and this in the Central to update the characteristic's value:

self.discoveredPeripheral?.writeValue(passwordData, forCharacteristic: self.characteristicSubscribed, type: CBCharacteristicWriteType.WithoutResponse)

Please let me know what I am doing wrong. Any sample project showing how to do what I am trying to would be highly appreciated.


Related posts

Recent Viewed