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

集成的详细步骤可以参考: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


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值