iOS React Native应用程序冻结RCTSRWebSocketErrorDomain线程14:EXC_BAD_ACCESS

时间:2018-03-20 00:48:15

标签: react-native websocket

我最近将我的应用程序升级到React Native版本0.54.2,从那时起,iOS在几分钟未使用后冻结。在升级之前,这种情况从未发生过。该错误源于RCTWebSocket.xcodeproj> RCTSRWebSocket.m。升级后有没有人经历过类似的问题?

开发环境:

Environment:
  OS: macOS Sierra 10.12.6
  Node: 6.11.0
  Yarn: Not Found
  npm: 5.2.0
  Watchman: 4.9.0
  Xcode: Xcode 9.2 Build version 9C40b
  Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed)
  react: ^16.3.0-alpha.2 => 16.3.0-alpha.2
  react-native: ^0.54.2 => 0.54.2

错误来源:

- (void)_failWithError:(NSError *)error;
{
  dispatch_async(_workQueue, ^{   <==== [Thread 14: EXC_BAD_ACCESS (code=1, address=0x30) ]
    if (self.readyState != RCTSR_CLOSED) {
      self->_failed = YES;
      [self _performDelegateBlock:^{
        if ([self.delegate respondsToSelector:@selector(webSocket:didFailWithError:)]) {
          [self.delegate webSocket:self didFailWithError:error];
        }
      }];

      self.readyState = RCTSR_CLOSED;
      self->_selfRetain = nil;

      RCTSRLog(@"Failing with error %@", error.localizedDescription);

      [self _disconnect];
    }
  });
}

我在某处读过这个崩溃不会发生在生产应用程序中,但我不想试图找出它是否真实..

1 个答案:

答案 0 :(得分:0)

我在编译时遇到与WebSocket相关的错误,要修复该错误,请检查RCTWebSocket.xcodeproj的“构建阶段”部分,然后查看“链接二进制文件与库”选项卡,您应该在其中有libfishhook.a,将其删除并再次添加