React native - 连接没有连接处理程序错误含义?

gur*_*e94 37 connection ios react-native

我创建了一个新的反应项目,当我在iOS上从xcode运行它时,控制台给了我:

2017-05-19 23:25:34.119 [info][tid:main][RCTBatchedBridge.m:77] Initializing <RCTBatchedBridge: 0x6100001a6c80> (parent: <RCTBridge: 0x6100000c46e0>, executor: RCTJSCExecutor)
2017-05-19 23:25:51.287 [info][tid:main][RCTRootView.m:295] Running application test ({
    initialProps =     {
    };
    rootTag = 1;
})
2017-05-19 23:25:51.289 [info][tid:com.facebook.react.JavaScript] Running application "test" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
2017-05-19 23:25:51.299771-0400 test[21948:1121429] [] nw_connection_get_connected_socket_block_invoke 3 Connection has no connected handler
2017-05-19 23:25:53.335282-0400 test[21948:1121426] [] nw_connection_get_connected_socket_block_invoke 4 Connection has no connected handler
2017-05-19 23:25:55.349190-0400 test[21948:1120112] [] nw_connection_get_connected_socket_block_invoke 5 Connection has no connected handler
Run Code Online (Sandbox Code Playgroud)

2017-05-19 23:25:51.299771-0400 test[21948:1121429] [] nw_connection_get_connected_socket_block_invoke 3 Connection has no connected handler这些行意味着什么以及如何解决问题?

当我尝试在我的应用程序中使用fetch并发现它不起作用时,我首先注意到了这一点.我在控制台中发现了这些消息,后来发现这些消息都发生在我的所有应用程序中,所以我认为这意味着它是我的配置问题?

我创建了一个新的测试程序来测试导致这种情况的原因并发现它发生在一个全新的项目上.下面是我的代码是生成上面的日志输出:

/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * @flow
 */

import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View
} from 'react-native';

export default class test extends Component {
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>
          Welcome to React Native!
        </Text>
        <Text style={styles.instructions}>
          To get started, edit index.ios.js
        </Text>
        <Text style={styles.instructions}>
          Press Cmd+R to reload,{'\n'}
          Cmd+D or shake for dev menu
        </Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});

AppRegistry.registerComponent('test', () => test);
Run Code Online (Sandbox Code Playgroud)

Aru*_*mar 46

尝试以下过程

Xcode菜单 - >产品 - >编辑方案......

环境变量 - >添加 - >名称:"OS_ACTIVITY_MODE",值:"禁用"

再次运行您的应用

  • 这不是解决方案,这是隐藏错误.还没有找到真正的修复:https://github.com/facebook/react-native/issues/10027 (54认同)
  • 这将在使用真实设备时隐藏您的NSLog.在真实设备上进行测试时,将"禁用"值更改为空字符串.请参阅/sf/answers/2928009521/ (2认同)

Dev*_*v01 17

我想出了解决方案:

要为OS活动模式关闭Verbose

  1. 从xcode菜单,Project - > Scheme - > Edit Scheme.
  2. 然后Run在左侧选择,然后选择Arguments右侧的选项卡.
  3. Environment Variables添加名称OS_ACTIVITY_MODE和值disable.

或者见下图.

在此输入图像描述

注意:图片的归功于Ramkrishna Sharma


小智 9

这个错误最有可能来自内置于react-native以连接到react-devtools的websocket.如果您在调试时没有运行react-devtools,那么您将收到此错误,并且它还会在桥上输出一堆消息,抱怨无法打开websocket(如果您使用的话,您将只会看到这些错误)像rn-snoopy这样的东西.

安装并打开react-devtools后,错误将立即停止.请参阅以下说明:https: //github.com/facebook/react-devtools/blob/master/packages/react-devtools/README.md