(一)安装react-native-fs库时,执行react-native link react-native-fs
命令,出现错误:
ERR! Something went wrong while linking.
Error: Expected "/*" or ";" but "\"" found.
Please file an issue here: https://github.com/facebook/react-native/issues
link失败,导致Xcode打不开。
解决办法:
参考"react-native link" error,打开xxx.xcodeproj下的project.pbxproj文件,找到HEADER_SEARCH_PATHS,将
HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../react-native/React/**","$(SRCROOT)/../node_modules/react-native-device-info/RNDeviceInfo";
改为
HEADER_SEARCH_PATHS = (
"$(SRCROOT)/../../../react-native/React/**,
"$(SRCROOT)/../node_modules/react-native-device-info/RNDeviceInfo",
);
之后执行react-native link react-native-fs
命令,link成功!