首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >LTSupportAutomotive:在当前参数寄存器中找到选择器名称:委托异常类型: SIGSEGV异常代码:位于0xac7c95df0的SEGV_ACCERR

LTSupportAutomotive:在当前参数寄存器中找到选择器名称:委托异常类型: SIGSEGV异常代码:位于0xac7c95df0的SEGV_ACCERR
EN

Stack Overflow用户
提问于 2019-01-24 01:28:03
回答 1查看 102关注 0票数 0

我在Swift中写了99%,我不明白为什么这个线程崩溃了。我不能重现它,但它有时会发生。

库是: LTSupportAutomotive https://github.com/mickeyl/LTSupportAutomotive

错误:(从HockeyApp崩溃报告程序获取)在当前参数寄存器委托中找到选择器名称

异常类型: SIGSEGV

异常代码: 0xac7c95df0处的SEGV_ACCERR

代码语言:javascript
运行
复制
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

中的崩溃代码

代码语言:javascript
运行
复制
-(void)characteristicDidUpdateValue
{
    NSData* value = _characteristic.value;
    [_buffer appendData:value];
    [self.delegate stream:self handleEvent:NSStreamEventHasBytesAvailable]; <--- here it is crashing
}

这里从下面开始:

代码语言:javascript
运行
复制
-(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来避免这种崩溃吗?

谢谢

EN

回答 1

Stack Overflow用户

发布于 2019-03-31 16:17:28

委托的声明是unsafe_unretained,而不是weak。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54332612

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档