做了一个蓝牙打印的app。
蓝牙连接没什么问题,但是打印出了一个问题
我使用如下代码将一个字符串打印出来
[_currentPeripheral writeValue:data forCharacteristic:_curcharacteristic type:CBCharacteristicWriteWithResponse];
如果我打印的字符串过长,总是打印到一半就打印不出来了。
我猜想这是IOS10的bug,因为之前这个程序在IOS9上并没有任何问题。
做过类似应用的朋友们,求问你们有没有遇到过这样的问题,最后你们是怎么解决的?
Bluetooth transmission is limited in data length and data cannot be sent to external devices all the time. You need to divide the data to be printed into multiple Data and send it to the peripheral device.
You can use
Look at the maximum length