xcode高版本启动RN项目常见错误

xcode编译报错:'config.h' file not found

image-20200409145441860

解决方案

cd node_modules/react-native/third-party/glog-0.3.4
../../scripts/ios-configure-glog.sh

image-20200409150129405

启动报错:Unknown argument type '__attribute__' in method -[RCTAppState getCurrentAppState:error:]. Extend RCTConvert to support this type.

Simulator Screen Shot - iPhone 11 Pro Max - 2020-04-09 at 15.07.23

我的xcode版本:Version 11.0 (11A420a)

Mac系统版本:10.14.6

原因Xcode11(iOS13)中对未使用的接口选择器的参数unused字符串属性进行了更改成了__unused__,导致ReactNative动态收集接口时不能把声明的接口进行导入,运行时无法查找到该接口导致的错误。

解决方案:找到文件/node_modules/react-native/React/Base/RCTModuleMethod.mm

修改方法:

static BOOL RCTParseUnused(const char **input)
{
  return RCTReadString(input, "__unused") ||
         RCTReadString(input, "__attribute__((unused))");
}

修改成:

static BOOL RCTParseUnused(const char **input)
{

  return RCTReadString(input, "attribute((unused))") ||
         RCTReadString(input, "__attribute__((__unused__))") ||
         RCTReadString(input, "__unused");
}
阅读 509

推荐阅读
移动端技术
用户专栏

移动端技术汇总

1543 人关注
64 篇文章
专栏主页