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

标签 ios react-native connection

我创建了一个新的 React 项目,当我在 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

什么 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);

最佳答案

尝试以下流程

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

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

再次运行您的应用

关于ios - React native - 连接没有连接处理程序错误含义?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44081674/

相关文章:

react-native - react native 推送通知(Android) - 通知不断重复并且不会停止

string - 如何通过telnet或任何其他程序将字符串数据发送到套接字连接?

connection - RabbitMQ客户端无法连接到远程RabbitMQ服务器

java - JDBC 检查连接是否可以保证它将无错误地提交

ios - 如何根据运行时系统iOS版本只覆盖一个方法?

iOS - 在 ViewController 上自动切换键盘

ios - 在后台线程加载 UITableView 图像

ios - 来电后无法录音

objective-c - 如何将新的 UIViewController 从 React-Native 推送到 Objective-C Native 桥

javascript - 如何从我的 react-native 应用程序打开笔记本电脑上的 chrome 选项卡(就像远程调试一样)?