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");
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章