React-Native 遇到坑,方法總結(jié)

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:執(zhí)行 npm run postinstall 修復(fù)。

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

把模擬器的鍵盤嘗試呼起就行。如下圖所示
20170111141824843.png

4:使用react-native時按cmd+d 沒有顯示debug的調(diào)試按鈕

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,解決首次加載會出現(xiàn)白屏的優(yōu)化。 在程序啟動的時候執(zhí)行 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)
    }
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容