'config.h' file not found 解决过程

时间:2022-08-06 02:18:11

最近将ReactNative业务集成进现有APP项目中,出现了几个具有代表性的问题,下面记录一下

问题1、

[!] CocoaPods could not find compatible versions for pod "React/RCTText":
  In Podfile:
    React/RCTText (from `./RN/node_modules/react-native`)
Specs satisfying the `React/RCTText (from `./RN/node_modules/react-native`)` dependency were found, but they required a higher minimum deployment target.
 
解决:将 platform :ios, '8.0' 改成:platform :ios, '9.0' 即可。
 
问题2、
[!] Unable to find host target(s) for *****Extension. Please add the host targets for the embedded targets to the Podfile.
Certain kinds of targets require a host target. A host target is a "parent" target which embeds a "child" target. These are example types of targets that need a host target:
- Framework
- App Extension
- Watch OS 1 Extension
- Messages Extension (except when used with a Messages Application)
 
解决过程1:网上有人说将cocoapods 降低一个版本,可以解决问题
 
$ gem list  查看安装的cocoapods 版本都有哪些
cocoapods (1.5.3, 1.3.1, 1.1.1)
$ pod _1.3.1_ install (无效)
$ pod _1.1.1_ install   (有效解决,但是会带来'config.h' file not found问题,并且无论怎么配置都没有用,项目始终报错。解决方案可以参考:React Native 'config.h' file not found 问题、configure: error: C compiler cannot create executables问题解决过程记录
 
解决过程2:经过思考问题应该不在podfile,想从Extension 入手解决。
 
   1、 打开XCode ,选择HOST target
   2、打开 target's 'General' 
   3、向下找到'Embedded Binaries',确定下 Extension target 是不是存在,如果存在的话,将其删掉,重新添加。如果不存在的话,需要添加。

 

'config.h' file not found 解决过程
 
之后,重新pod install 安装即可,一直困扰的'config.h' file not found 问题也解决了。