美文网首页
React-Native 遇到坑,方法总结

React-Native 遇到坑,方法总结

作者: 刘小弟 | 来源:发表于2017-12-13 14:03 被阅读2665次

1:Print: Entry, ":CFBundleIdentifier", Does Not Exist

方法1,初始化的,指定项目版本(不推荐)
 react-native init MyAppName --version 0.44.3
方法2,更新RN 0.45以上版本所需的第三方编译boost库。boost链接地址

2:IOS编译时报错:'RCTAnimation/RCTValueAnimatedNode.h' file not found, 'fishhook/fishhook.h' file not found

方法1:每次重新生成node_modules文件夹,都需要修改一次(不推荐)
#import <RCTAnimation/RCTValueAnimatedNode.h>
把修改为
#import "RCTValueAnimatedNode.h"
方法2:执行 npm run postinstall 修复。

3:使用react-native时按cmd+r不能刷新模拟器

把模拟器的键盘尝试呼起就行。如下图所示 20170111141824843.png

4:使用react-native时按cmd+d 没有显示debug的调试按钮

ios在podfile文件中,加入 'DevSupport'。如图所示 屏幕快照 2017-12-12 下午5.31.29.png

5:react-native link 的 Error: Cannot read property 'match' of undefined"

ios在podfile文件中,加入 ' # Add new pods below this line 屏幕快照 2017-12-12 下午5.31.29.png

'。如图所示!

6:老项目加入RN,解决首次加载会出现白屏的优化。 在程序启动的时候执行 RNRootViewController.preLoad()
class RNRootViewController: MLViewController, UIGestureRecognizerDelegate {

    static var bridge: RCTBridge?
    private var rootView: RCTRootView!

    static func preLoad() {
        let jsCodeLocation = URL(string: "http://localhost:8081/index.bundle?platform=ios")
        RNRootViewController.bridge = RCTBridge(bundleURL: jsCodeLocation,
                                                moduleProvider: nil,
                                                launchOptions: nil)
        _ = RNRootViewController(moduleName: "customerService", params: nil)
    }

相关文章

网友评论

      本文标题:React-Native 遇到坑,方法总结

      本文链接:https://www.haomeiwen.com/subject/pkynixtx.html