2017-05-09 49 views
3

我有一個有兩個需求的react-native項目。它需要與Airbnb的native-navigation library一起工作,它需要一個Realm數據庫。我有時間讓兩個圖書館努力工作。由於Native-navigation使用Swift文件,因此需要通過cocoapods安裝react-native和其他本地庫。使用像Realm一樣的靜態框架,通過Cocoapods安裝React-Native

領域,不是一個椰子友好的圖書館,所以我一直在關注這個基本設置,我從airbnb的樣板ReactNativeStarter開始。此時該項目建立並運行,但是當我引入Realm時,我在生成項目時遇到了錯誤,它找不到React頭文件

這裏是我的步驟:

1)通過npm install --save realm

2)挖安裝的境界到/node_modules/realm/react-native/ios/並拖動RealmReact.xcodeproj到樣板的ReactNativeStarter.xcworkspace文件中生成ReactNativeStarter項目

enter image description here

3)我然後添加以下的頭搜索路徑領域作出反應$(SRCROOT)/../../../../ios/Pods/Headers/Public

enter image description here

我認爲這是值得一提的是,/莢/頭文件夾中包含什麼。 React的這個possibly an issue with cocoapods not generating the header files是否正確?

4)我補充下libRealmReact.a靜態庫 '鏈接的框架和庫'

enter image description here

5)最後,我想補充$(SRCROOT)/../node_modules/realm/src爲ReactNativeStarter項目的標題搜索路徑。 enter image description here

問題 - 在這一點上建設項目仍然會導致下面的xcode生成錯誤:

/Users/some.guy/ReactNative/SaveAs/node_modules/react-native/React/Base/RCTBridge .h:12:9:未找到'React/RCTBridgeModule.h'文件

+0

你沒有將庫與'react-native link'鏈接起來的原因?手動鏈接時,我最近遇到了與Realm有關的問題。 – sooper

+0

@scooper。是的,我嘗試使用react-native鏈接進行鏈接。相同的結果。 – nwales

+0

我遇到了與其他庫類似的問題。你能解決這個問題嗎? – darkmatter

回答

0

刪除節點模塊並重新安裝。運行此:

  • 守望手錶德爾 - 所有
  • 室射頻node_modules/
  • NPM安裝

之後,運行:反應本地升級重新連結你的母語依賴性在react-native應該可以解決你的問題,不要忘了在Xcode中清理你的項目。

相關問題