ios - 在 Xcode 中运行初始化的 React Native 项目时出错

标签 ios react-native

安装 react-native 并运行新创建的 Xcode 项目后,我得到以下输出:

2015-03-26 15:35:05.865 React[1427:7950] CLTilesManagerClient: initialize, sSharedTilesManagerClient
2015-03-26 15:35:05.865 React[1427:7950] CLTilesManagerClient: init
2015-03-26 15:35:05.866 React[1427:7950] CLTilesManagerClient: reconnecting, 0x7fac1b289e40
RCTJSLog> "Running application "React" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF"
RCTJSLog> "Error: 
 stack: 
  React_render                                       index.ios.bundle:955
  _renderValidatedComponentWithoutOwnerOrContext     index.ios.bundle:16453
  _renderValidatedComponent                          index.ios.bundle:16479
  ReactCompositeComponent__renderValidatedComponent  index.ios.bundle:4860
  mountComponent                                     index.ios.bundle:15913
  ReactCompositeComponent_mountComponent             index.ios.bundle:4860
  mountComponent                                     index.ios.bundle:4929
  mountComponentIntoNode                             index.ios.bundle:15386
  perform                                            index.ios.bundle:5992
  batchedMountComponentIntoNode                      index.ios.bundle:15405
  perform                                            index.ios.bundle:5992
  batchedUpdates                                     index.ios.bundle:13507
  batchedUpdates                                     index.ios.bundle:4524
  renderComponent                                    index.ios.bundle:15457
  ReactMount__renderNewRootComponent                 index.ios.bundle:4860
  render                                             index.ios.bundle:1155
  renderApplication                                  index.ios.bundle:33797
  run                                                index.ios.bundle:33743
  runApplication                                     index.ios.bundle:33765
  jsCall                                             index.ios.bundle:7149
  _callFunction                                      index.ios.bundle:7396
  applyWithGuard                                     index.ios.bundle:877
  guardReturn                                        index.ios.bundle:7198
  callFunctionReturnFlushedQueue                     index.ios.bundle:7405
 URL: http://localhost:8081/index.ios.bundle
 line: 955
 message: undefined is not a function (evaluating 'React.createElement(Text, {style: styles.welcome}, 
          "Welcome to React Native!"
        )')"

任何帮助找出失败原因的人都将不胜感激。

谢谢!

最佳答案

要在设备上运行(这是您的第二个问题),请查看 React Native 示例中的这些注释:

https://github.com/facebook/react-native/blob/master/Examples/Movies/Movies/AppDelegate.m

To run on device, change localhost to the IP address of your computer, and make sure your computer and iOS device are on the same Wi-Fi network.

我认为这是因为应用程序需要连接到打包器。看看是否有帮助。

关于ios - 在 Xcode 中运行初始化的 React Native 项目时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29290299/

相关文章:

ios - 在 Swift4 中播放声音

iOS 不断增长的内存使用量

ios - MPMoviePlayerController 重新启动而不是恢复

javascript - 如何在 React Native 中正确对齐文本输入?

android - 如何在 android 上使用离线包来 react 原生项目?

javascript - 检查颜色是否为字符串 ('white' === color?//true, 'bright white gold' === color?//false)

ios - 在 iOS 上同时下载多少是有意义的

React-Native:底部选项卡导航器: 'tabBarOptions' 已弃用。将选项迁移到 'screenOptions'

java - React-Native:WritableMap 的逻辑比较

iphone - 再次获取允许或不允许用户定位到 iPhone 模拟器的消息