执行react-native init PROJECT_NAME
之后,卡info Installing required CocoaPods dependencies
不动或者很缓慢
手动CTRL+C打断进程,卸载cocoapods,重新设置gem源和安装删除cocoapods
sudo gem uninstall cocoapods cocoapods-core
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
gem sources -l
sudo gem install cocoapods
pod setup
继上面的步骤,进入到项目根目录,手动安装pod,安装过一次之后,后面安装就会很快
cd ios
pod install --verbose --no-repo-update
参考链接
https://www.cnblogs.com/stevexu/archive/2019/04/21/10745769.html
https://github.com/facebook/react-native/issues/20774
https://blog.csdn.net/wzzvictory/article/details/18737437
执行cd RN && react-native run-ios
之后,报错error Could not find "iPhone X" xcode simulator.
- 切换到xcode simulator,查看可用simulator设备
xcrun simctl list devices
- 或者模拟器查看
- 指定已存在,如上面的iPhone 11
react-native run-ios --simulator="iPhone 11"
创建react-native项目时,用typescript替换js,注意react-native@0.61.0 or higher与react-native@0.60.x的差异
react-native init PROJECT_NAME --template react-native-template-typescript
参考链接
https://github.com/facebook/react-native/issues/26727
https://github.com/react-native-community/react-native-template-typescript/blob/master/README.md#note-on-the-legacy-clip
在xcode11上启动xcode10项目时报错,Unknown argument type '__attribute__' in method -[RCTAppState getCurrentAppState:error:]. Extend RCTConvert to support this type.
参考链接
https://github.com/facebook/react-native/issues/25138
https://github.com/facebook/react-native/pull/25146