2
votes

I have an app that communicates iDevice-to-iDevice over Bluetooth LE using the CoreBluetooth framework. For one of my characteristics, I send a date encoded with NSKeyedArchiver (such as in the accepted answer for this question).

When this happens, I get:

CoreBluetooth[WARNING] Unknown Error: 9

And the peripheral doesn't even receive the write request, nor does it throw any errors.

On the central side, it does the following:

NSData *data = [NSKeyedArchiver archivedDataWithRootObject:self.myDate];
[self.connectedDevice writeValue:data forCharacteristic:self.myCharacteristic type:CBCharacteristicWriteWithResponse];

Where myDate is a valid NSDate.

I know that per the Bluetooth Core 4.0 documentation, Volume 2, Part D, Section 2, error code 0x09 is Connection Limit Exceeded. However, this doesn't make sense in this situation (there is only one connection between the two).

An interesting fact is that if I just encode a string and send it, there is no problem:

NSData *data = [self.localTestString dataUsingEncoding:NSUTF8StringEncoding];
[self.connectedDevice writeValue:data forCharacteristic:self.myCharacteristic type:CBCharacteristicWriteWithResponse];

The peripheral receives the write request, can decode it properly, and can accept it without problems.

Anyone have any idea what's going on?

1

1 Answers

0
votes

How big is your keyed-archive data and your local test string? It sounds like you may be exceeding the writable size for the characteristic.