Swift工程集成RN时遇到的错误及其解决办法

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/jancywen/article/details/80337510

集成的详细步骤可以参考:https://reactnative.cn/docs/0.51/integration-with-existing-apps.html#content


遇到的问题,

1,pod install时,名字不匹配,

[!] The name of the given podspec `yoga` doesn't match the expected one `Yoga`

[!] The name of the given podspec `glog` doesn't match the expected one `GLog`

解决办法:直接改动podfile文件的名字即可

2.pod install报错

[!] Unable to find a specification for `boost-for-react-native` depended upon by `Folly`

解决办法: 弄个VPN  pod update


3,could not build module 'yoga',  'algorithm' file not found 

解决办法: 这个是cocoapods的问题,只需要在文件 'node_modules/react-native/ReactCommon/yoga/yoga.podspec' 加入下行代码

spec.public_header_files = 'yoga/Yoga.h', 'yoga/YGEnums.h', 'yoga/YGMacros.h'

如下

  # Set this environment variable when not using the `:path` option to install the pod.
  # E.g. when publishing this spec to a spec repo.
  source_files = 'yoga/**/*.{cpp,h}'
  source_files = File.join('ReactCommon/yoga', source_files) if ENV['INSTALL_YOGA_WITHOUT_PATH_OPTION']
  spec.source_files = source_files
  # Only expose the needed headers
  spec.public_header_files = 'yoga/Yoga.h', 'yoga/YGEnums.h', 'yoga/YGMacros.h'
end


猜你喜欢

转载自blog.csdn.net/jancywen/article/details/80337510