2016-06-10 64 views
2

我最近更新到ReactNativeControllers 2.03從1.24。我也更新了RN到0.25。我正在使用僅添加Podspec文件的fork。整理出在RN我現在難倒這個錯誤的所有進口變化後:Javascript /本機代碼不同步(參數數量不同)錯誤

(也https://github.com/wix/react-native-controllers/issues/59見)

RCCManager.setRootController was called with 3 arguments, but expects 2. If you haven't changed this method yourself, this usually means that your versions of the native code and JavaScript code are out of sync. Updating both should make this error go away.

有問題的代碼:

RCCManagerModule.m

setRootController:(NSDictionary*)layout animationType:(NSString*)animationType globalProps:(NSDictionary*)globalProps) 

and index.js

ControllerRegistry: { 
    registerController: function (appKey, getControllerFunc) { 
     _controllerRegistry[appKey] = getControllerFunc(); 
    }, 
    setRootController: function (appKey, animationType = 'none', passProps = {}) { 
     var controller = _controllerRegistry[appKey]; 
     if (controller === undefined) return; 
     var layout = controller.render(); 
     _validateDrawerProps(layout); 
     RCCManager.setRootController(layout, animationType, passProps); 
    } 
    }, 

顯而易見,兩者都有3個參數。

我已經殺死並重新啓動打包程序。我已經清理了Xcode項目,包括派生數據,並刪除了看守員緩存watchman watch-del-all。我刪除了我的node_modules文件夾,完成了npm installpod install

我已經重建了Xcode項目。仍然沒有運氣。我不知道如何進一步調試。

編輯:我也試着清理莢緩存,更新的CocoaPods 1.01 ...

我有一種感覺,有可能在這裏是一個紅色的鯡魚的地方。僅供參考我的完整跟蹤看起來是這樣的:

2016-06-10 14:15:18.179 [warn][tid:com.facebook.React.JavaScript] Warning: ReactNative.Component is deprecated. Use React.Component from the "react" package instead. 
2016-06-10 14:15:18.239 JustTuner[7523:185768] Launching Couchbase Lite... 
2016-06-10 14:15:19.048 JustTuner[7523:185768] Couchbase Lite url = http://adamwilsonsMBP.lan:5984/ 
2016-06-10 14:15:19.050 JustTuner[7523:185768] Launching Couchbase Lite... 
2016-06-10 14:15:19.058 JustTuner[7523:185768] Couchbase Lite url = http://adamwilsonsMBP.lan:5984/ 
2016-06-10 14:15:19.538 [error][tid:main][RCTModuleMethod.m:456] RCCManager.setRootController was called with 3 arguments, but expects 2.     If you haven't changed this method yourself, this usually means that     your versions of the native code and JavaScript code are out of sync.     Updating both should make this error go away. 

回答

2

花費很多時間努力工作,這一點後,我發現,在build/Products/Debug-iphonesimulator是一個過時的靜態庫libReactNativeControllers.a的。

刪除libReactNativeControllers.a並重建項目解決了這個問題。

看來Pod靜態庫現在被保存在它們各自的文件夾中,例如build/Products/Debug-iphonesimulator/ReactNativeControllers/libReactNativeControllers.a

我的猜測是最近的版本是保存在子文件夾中的靜態庫,但鏈接器正在挑選過時的。任何人都知道爲什麼這可能最近改變了?

+4

有點偏離主題,但我希望有一個叫做XCode的大稻草人,我們可以每年都聚在一起燒掉它。喝一杯,然後互相哭泣。 – Trip