RN集成到IOS的坑

1532 查看

  1. 报错App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure

    • 在Info.plist(正式项目下非test添加)添加字段,具体参考点这里

  2. 手动集成,不要用cnpm下载安装包,因为cnpm下载到node_moudles下面的包都是从.npminstall映射过来的,在启动开发服务器的时候监控的文件地址会错误。

  3. +[RCTBatchedBridge redBox]: unrecognized selector sent to instance 0x7fb59d8ab200

    • 在项目的Build Settings添加如下设置:具体参考点击这里

  4. 运行react-native项目babelHelpers报错

    • 添加.babelrc文件,然后重新启动服务器,具体参考点击这里

  5. 使用cocoapods集成时,注意新的PodFile写法, 并且写好target

    target 'POD' do
    pod 'React', :path => './reactnative/node_modules/react-native', :subspecs => [
      'Core',
      'RCTNetwork',
      'RCTText',
      'RCTWebSocket',
      # 添加其他你想在工程中使用的依赖。
    ]
    end
  6. Undefined symbols for architecture x86_64:
    "_OBJC_CLASS_$_RCTRootView", referenced from: objc-class-ref in StashView.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)