Я пишу 99% на Swift и не понимаю, почему эта тема рушится. Я не могу воспроизвести это, но это иногда случается.
Библиотека: LTSupportAutomotive
https://github.com/mickeyl/LTSupportAutomotive
Ошибка: (получено от HockeyApp Crash Reporter)
Имя селектора, найденное в регистрах аргументов текущего аргумента
Тип исключения: SIGSEGV
Коды исключений: SEGV_ACCERR в 0xac7c95df0
Thread 6 Crashed:
0 libobjc.A.dylib 0x00000001fe175430 objc_retain + 16
1 LTSupportAutomotive 0x00000001065816f8 -[LTBTLEReadCharacteristicStream characteristicDidUpdateValue] (LTBTLEReadCharacteristicStream.m:43)
2 LTSupportAutomotive 0x0000000106582ac8 -[LTBTLESerialTransporter peripheral:didUpdateValueForCharacteristic:error:] (LTBTLESerialTransporter.m:299)
3 CoreBluetooth 0x0000000204b42cc0 -[CBPeripheral handleAttributeEvent:args:attributeSelector:delegateSelector:delegateFlag:] + 236
4 CoreBluetooth 0x0000000204b42e20 -[CBPeripheral handleCharacteristicEvent:characteristicSelector:delegateSelector:delegateFlag:] + 128
5 CoreBluetooth 0x0000000204b3e4d0 -[CBPeripheral handleMsg:args:] + 352
6 CoreBluetooth 0x0000000204b38bdc -[CBCentralManager handleMsg:args:] + 200
7 CoreBluetooth 0x0000000204b47750 __30-[CBXpcConnection _handleMsg:]_block_invoke + 56
8 libdispatch.dylib 0x00000001fe9c56c8 _dispatch_call_block_and_release + 20
9 libdispatch.dylib 0x00000001fe9c6484 _dispatch_client_callout + 12
10 libdispatch.dylib 0x00000001fe96dbd0 _dispatch_lane_serial_drain$VARIANT$mp + 588
11 libdispatch.dylib 0x00000001fe96e74c _dispatch_lane_invoke$VARIANT$mp + 480
12 libdispatch.dylib 0x00000001fe96da9c _dispatch_lane_serial_drain$VARIANT$mp + 280
13 libdispatch.dylib 0x00000001fe96e718 _dispatch_lane_invoke$VARIANT$mp + 428
14 libdispatch.dylib 0x00000001fe976eb8 _dispatch_workloop_worker_thread + 596
15 libsystem_pthread.dylib 0x00000001feba90dc _pthread_wqthread + 308
16 libsystem_pthread.dylib 0x00000001febabcec start_wqthread + 0
Код сбоя в
-(void)characteristicDidUpdateValue
{
NSData* value = _characteristic.value;
[_buffer appendData:value];
[self.delegate stream:self handleEvent:NSStreamEventHasBytesAvailable]; <--- here it is crashing
}
здесь начинается с:
-(void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error
{
#ifdef DEBUG_THIS_FILE
NSString* debugString = [[NSString alloc] initWithData:characteristic.value encoding:NSUTF8StringEncoding];
NSString* replacedWhitespace = [[debugString stringByReplacingOccurrencesOfString:@"\n" withString:@"\\n"] stringByReplacingOccurrencesOfString:@"\r" withString:@"\\r"];
XLOG( @"%@ >>> %@", peripheral, replacedWhitespace );
#endif
if ( error )
{
LOG( @"Could not update value for characteristic %@: %@", characteristic, error );
return;
}
[_inputStream characteristicDidUpdateValue]; <---
}
Может кто-нибудь помочь мне с Objective-C, чтобы избежать этого сбоя?
Спасибо