##react native 常见问题记录
1. react-native 运行应用xcode打印log__nw_connection_get_connected_socket_block_invoke Connection has no connected handler
1. Xcode menu -> Product -> Edit Scheme...
2. Environment Variables -> Add -> Name: "OS_ACTIVITY_MODE", Value:"disable"
3. Run your app again, done! 这样就没问题了
2. 新建RN项目,运行不了,提示Print:Entry,":CFBundleIdentifier",Does Not Exist
该问题记录于(2017/6/12),是因为react-native更新了新版本0.45导致的一个bug吧,后面官方应该会解决这个问题!
解决方案是,降级回老版本!
1. 修改package.json 文件
"dependencies": {
"react": "16.0.0-alpha.6",
"react-native": "0.44.0"
},
"devDependencies": {
"babel-jest": "20.0.0",
"babel-preset-react-native": "1.9.2",
"jest": "20.0.4",
"react-test-renderer": "16.0.0-alpha.6"
},
2. 删掉原来的node_modules整个文件夹,然后
npm install
3.RCTBridgeModule.h file not found
-
修改
#import "RCTBridgeModule.h" 换为 #import <React/RCTBridgeModule.h>
-
如果还是提示
React/RCTBridgeModule.h file not found
- 在Xcode 项目设置界面中 Header Search Paths 中添加$(SRCROOT)/../node_modules/react-native/React
- 如果不懂Header Search Paths 配置路径,百度一下咯
4. 报错 Command /bin/sh failed with exit code 1
解决方法:项目->Build Phases->Bundle React Native code and images -> 勾选 Run script only when installing
5. 'boost/iterator/iterator_adaptor.hpp' file not found
-
产生原因:
/Users/Vanessa/.rncache 中 boost_1_63_0.tar.gz, double-conversion-1.1.5.tar.gz, folly-2016.09.26.00.tar.gz, glog-0.3.4.tar.gz 文件下载不完整 node_modules/react-native/third-party 文件不完整
-
解决方案:
删除 .rncache 后重新下载,或手动下载后放入 .rncache 中 把以上文件解压后放入 node_modules/react-native/third-party 下 Clean & Build
6. react-navigation 与 SectionList、listView、flatlist等配合使用,不能展示视图,要拉一下才能显示出来
-
解决方法1:
添加这个属性 removeClippedSubviews={false}
-
解放方法2:
flex:1
7. Redefinition of module 'RSKImageCropper'
@NewBen001 yes, but with the bad solution. Just following the message's commit of ruslanskorb/RSKImageCropper@7d5ea88
Go to folder
node_modules/react-native-image-crop-picker/ios rename the file
module.modulemap > RSKImageCropper.modulemap then edit the file RSKImageCropper.xcodeproj/project.pbxproj and add this line two times (in debug and release part Cf Commit): MODULEMAP_FILE = "$(SRCROOT)/RSKImageCropper/RSKImageCropper.modulemap";
Clean and build. It should be works.
PS: It was a fail to me to switch on cocoapods, that's why i'm doing that and waiting for the fix. I will try to work on a PR this week-end but not sure.