簡體   English   中英

安裝 React Native Map。 在 UIManager 中找不到 AIRMap

[英]Installing React Native Map. AIRMap not found in UIManager

可能有幾個人在問這個問題,我一直在 Github 上找遍了,但找不到適用於安裝 React Native Maps 的解決方案......

不變違規:requireNativeComponent:在 UIManager 中找不到“AIRMap”。

此錯誤位於:在 AIRMap (在 MapView.js:760) 在 MapView (在 Home.js:118)

  "react-native": "^0.57.0-rc.4",
  "react-native-maps": "^0.21.0",

我試過了:

rm -rf ios android node_modules
npm install
react-native upgrade
react-native link

libAirMaps.a is added in Build Phases
AirGoogleMaps and AirMaps is added to Libraries

按照本指南手動添加 iOS 版 Maps SDK,無需 CocoaPods: https : //developers.google.com/maps/documentation/ios-sdk/start

添加@import GoogleMaps; [GMSServices provideAPIKey:@"_YOUR_API_KEY_"]; AppDelegate.m

仍然得到同樣的錯誤...

我沒有將它添加到 package.json,因為我不確定它要求什么路徑? 我在https://github.com/react-community/react-native-maps/blob/master/docs/installation.md找到了這個

{
  "name": "your-app",
  "scripts": {
    "postinstall": "./node_modules/react-native-maps/enable-google-maps REPLACE_ME_RELATIVE_PATH_TO_GOOGLE_MAPS_INSTALL"
  }
}

如果您按照Google Map doc手動安裝SDK,您可能已經將這三個框架添加到您的項目中,只需在Xcode中右鍵單擊該框架,然后在Finder中顯示,您就可以在finder中找到該框架文件

在此處輸入圖片說明

在此處輸入圖片說明

就我而言, REPLACE_ME_RELATIVE_PATH_TO_GOOGLE_MAPS_INSTALL指的是我的 ios 目錄,相關路徑是./ios ,只需將其添加到package.json文件並運行npm install

 { "name": "your-app", "scripts": { "postinstall": "./node_modules/react-native-maps/enable-google-maps ./ios" } }

另一個答案可能不再與 RN >0.60 相關。 請務必按照此處的安裝說明進行操作: https : //github.com/react-native-community/react-native-maps/blob/master/docs/installation.md ,其中包括 appdelegate.m 更改和 podfile 更改. 然后還將以下行添加到 podfile 的頂部。

源' https://github.com/CocoaPods/Specs.git '

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM