首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何修复Ionic 4 IOS上尚未安装或准备好的“cordova-”

如何修复Ionic 4 IOS上尚未安装或准备好的“cordova-”
EN

Stack Overflow用户
提问于 2019-06-06 14:06:31
回答 1查看 3.2K关注 0票数 4

我使用GoogleMaps在Ionic 4上开发了一个应用程序。我最初是在Android上开发的,然后当我想把我的项目导出到IOS系统时出现了问题。

我想指出的是,我在Android上使用了cordova插件-googlemaps "multiple_maps“版本,没有它,我就无法让地图在Android上工作。

我为我的项目安装了依赖项:

  • cordova准备ios
  • npm安装“离子-本机/核心”β
  • npm安装@离子型-原生/谷歌-地图@beta
  • 离子cordova插件添加cordova插件-googlemaps-变量API_KEY_FOR_ANDROID=“我的安卓键”-变量API_KEY_FOR_IOS=“我的IOS键”

但有了这最后的命令,问题就出现了。我可以在控制台上看到android和浏览器安装得很好,ios也多亏了"pod“。因此,我试图构建Xcode:我有错误,文件"GoogleMaps/GoogleMaps.h“找不到。

我找到的解决方案是打开Podfile文件,并将GoogleMaps的版本从默认的"2.7.0“更改为"3.1.0”。因此,我删除了Podfile.lock文件和Pods文件夹,并重新启动了一个pod安装。

不幸的是,我仍然有"GoogleMaps/GoogleMaps.h是找不到“的错误,但是我成功地删除了这个错误并启动了这个应用程序(不幸的是,我已经不知道该怎么做了)。

而不是地图,我有一个错误“googlemaps cordova插件-googlemaps还没有安装或准备好。”我很确定它背后的代码是安全的,因为它在Android上没有任何问题。

以下是我的不同信息:

操作系统: Mojave 10.14.5 (最后版本) XCode : 10.2 (最后版本) cordova : 8.1.2 cordova-ios : 5.0.1离子: 5.0.1

我的科多瓦插件列表:

cordova-clipboard 1.2.1 "Clipboard" cordova-plugin-camera 4.0.3 "Camera" cordova-plugin-device 2.0.2 "Device" cordova-plugin-file 6.0.1 "File" cordova-plugin-file-transfer 1.7.1 "File Transfer" cordova-plugin-filepath 1.5.1 "cordova-plugin-filepath" cordova-plugin-geolocation 4.0.1 "Geolocation" cordova-plugin-googlemaps 2.6.2 "cordova-plugin-googlemaps" cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard" cordova-plugin-ionic-webview 3.1.2 "cordova-plugin-ionic-webview" cordova-plugin-mauron85-background-geolocation 3.0.3 "CDVBackgroundGeolocation" cordova-plugin-network-information 2.0.1 "Network Information" cordova-plugin-splashscreen 5.0.2 "Splashscreen" cordova-plugin-statusbar 2.4.2 "StatusBar" cordova-plugin-whitelist 1.3.3 "Whitelist" info.protonet.imageresizer 0.1.1 "Image Resizer"

我的package.json

代码语言:javascript
复制
"dependencies": {
    "@angular/common": "^7.2.13",
    "@angular/core": "^7.2.13",
    "@angular/forms": "^7.2.13",
    "@angular/http": "^7.2.13",
    "@angular/platform-browser": "^7.2.13",
    "@angular/platform-browser-dynamic": "^7.2.13",
    "@angular/router": "^7.2.13",
    "@ionic-native/splash-screen": "^5.4.0",
    "@ionic-native/status-bar": "^5.4.0",
    "@ionic/angular": "^4.3.0",
    "@mauron85/cordova-plugin-background-geolocation": "3.0.3",
    "cordova-android": "8.0.0",
    "cordova-browser": "6.0.0",
    "cordova-clipboard": "1.2.1",
    "cordova-ios": "4.5.5",
    "cordova-plugin-camera": "4.0.3",
    "cordova-plugin-device": "2.0.2",
    "cordova-plugin-file": "6.0.1",
    "cordova-plugin-file-transfer": "1.7.1",
    "cordova-plugin-filepath": "1.5.1",
    "cordova-plugin-geolocation": "4.0.1",
    "cordova-plugin-googlemaps": "git+https://github.com/mapsplugin/cordova-plugin-googlemaps.git#multiple_maps",
    "cordova-plugin-ionic-keyboard": "^2.0.5",
    "cordova-plugin-ionic-webview": "^3.0.0",
    "cordova-plugin-mauron85-background-geolocation": "^3.0.1",
    "cordova-plugin-network-information": "2.0.1",
    "cordova-plugin-splashscreen": "5.0.2",
    "cordova-plugin-statusbar": "2.4.2",
    "cordova-plugin-whitelist": "1.3.3",
    "cordova-windows": "4.4.2",
    "core-js": "^2.5.4",
    "info.protonet.imageresizer": "0.1.1",
    "ionic-plugin-keyboard": "2.2.1",
    "zone.js": "~0.8.29"
},
"devDependencies": {
    "@angular-devkit/architect": "~0.12.3",
    "@angular-devkit/build-angular": "^0.13.8",
    "@angular-devkit/core": "~7.2.3",
    "@angular-devkit/schematics": "~7.2.3",
    "@angular/cli": "^7.3.8",
    "@angular/compiler": "^7.2.13",
    "@angular/compiler-cli": "^7.2.13",
    "@angular/language-service": "^7.2.13",
    "@fortawesome/angular-fontawesome": "^0.3.0",
    "@fortawesome/fontawesome-free": "^5.8.1",
    "@fortawesome/fontawesome-svg-core": "^1.2.17",
    "@fortawesome/free-brands-svg-icons": "^5.8.1",
    "@fortawesome/free-regular-svg-icons": "^5.8.1",
    "@fortawesome/free-solid-svg-icons": "^5.8.1",
    "@ionic-native/background-geolocation": "^5.4.0",
    "@ionic-native/camera": "^5.5.1",
    "@ionic-native/clipboard": "^5.4.0",
    "@ionic-native/core": "^5.0.0",
    "@ionic-native/file": "^5.5.1",
    "@ionic-native/file-path": "^5.5.1",
    "@ionic-native/geolocation": "^5.4.0",
    "@ionic-native/google-maps": "^5.0.0-beta.27",
    "@ionic-native/image-resizer": "^5.5.1",
    "@ionic-native/keyboard": "^5.4.0",
    "@ionic-native/network": "^5.6.0",
    "@ionic-native/transfer": "^3.14.0",
    "@ionic/angular-toolkit": "~1.4.0",
    "@ionic/app-scripts": "^3.2.3",
    "@ngx-translate/core": "^11.0.1",
    "@ngx-translate/http-loader": "^4.0.0",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~10.14.2",
    "codelyzer": "~4.5.0",
    "cordova": "^8.1.2",
    "ionic4-rating": "^1.0.9",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~3.1.4",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "node-sass": "^4.12.0",
    "protractor": "~5.4.0",
    "rxjs": "^6.5.2",
    "rxjs-compat": "^6.4.0",
    "ts-node": "~8.0.0",
    "tslint": "~5.12.0",
    "typescript": "~3.1.6"
},
"description": "Test",
"cordova": {
    "platforms": [
        "windows",
        "browser"
    ],
    "plugins": {
        "cordova-plugin-geolocation": {
            "GEOLOCATION_USAGE_DESCRIPTION": ""
        },
        "cordova-plugin-whitelist": {},
        "cordova-plugin-statusbar": {},
        "cordova-plugin-device": {},
        "cordova-plugin-splashscreen": {},
        "cordova-plugin-ionic-webview": {
            "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
        },
        "cordova-plugin-ionic-keyboard": {},
        "cordova-clipboard": {},
        "cordova-plugin-mauron85-background-geolocation": {
            "GOOGLE_PLAY_SERVICES_VERSION": "11+",
            "ANDROID_SUPPORT_LIBRARY_VERSION": "26+",
            "ICON": "@mipmap/icon",
            "SMALL_ICON": "@mipmap/icon",
            "ACCOUNT_NAME": "@string/app_name",
            "ACCOUNT_LABEL": "@string/app_name",
            "ACCOUNT_TYPE": "$PACKAGE_NAME.account",
            "CONTENT_AUTHORITY": "$PACKAGE_NAME"
        },
        "cordova-plugin-camera": {},
        "cordova-plugin-file": {},
        "cordova-plugin-file-transfer": {},
        "cordova-plugin-filepath": {},
        "info.protonet.imageresizer": {},
        "cordova-plugin-network-information": {},
        "cordova-plugin-googlemaps": {
            "API_KEY_FOR_ANDROID": "My_Key",
            "API_KEY_FOR_IOS": "My_Key",
            "LOCATION_WHEN_IN_USE_DESCRIPTION": "This app wants to get your location while this app runs only.",
            "LOCATION_ALWAYS_USAGE_DESCRIPTION": "This app wants to get your location always, even this app runs in background."
        }
    }
}

我会很感激给出的每一个线索,我真的迷路了。谢谢你的帮助!如果有什么不清楚的地方,请问我会尽量解释得更好。

编辑:我创建了一个最小的项目来重现问题https://github.com/NuritArmelle/Bug-googlemaps-not-installed

下面是我在Mac上复制的步骤:

代码语言:javascript
复制
npm install
npm rebuild node-sass --unsafe-perm
ionic cordova platform add ios
ionic cordova prepare ios
npm install @ionic-native/core@beta
npm install @ionic-native/google-maps@beta
ionic cordova plugin add cordova-plugin-googlemaps#multiple_maps --variable API_KEY_FOR_ANDROID="my android key" --variable API_KEY_FOR_IOS="my IOS key"

此时,当我尝试构建时,它已经给了我一个错误"GoogleMaps/GoogleMaps.h是找不到的“。(这次我在xcworkspace上)。

然后,我在it/ios上创建了我的Podfile (以下是它的内容):

代码语言:javascript
复制
DO NOT MODIFY -- auto-generated by Apache Cordova
platform :ios, '8.0'
target 'Bug-Googlemaps-not-installed' do
    project 'Bug-Googlemaps-not-installed.xcodeproj'
    pod 'GoogleMaps', '~> 2.7.0'
end

最后,我做了一个“吊舱安装”。同样的问题,也无法建立"GoogleMaps.h“的事业。

EN

回答 1

Stack Overflow用户

发布于 2021-08-11 17:00:07

我以这种方式解决问题,遵循我所做的更改:

  1. 删除这些文件夹: platforms、node_modules、plugins、www e package-lock.json。
  2. 卸载cordova:sudo npm uninstall -g cordova
  3. 安装cordova:sudo npm install -g cordova
  4. 从google安装SDK:ionic cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk.git
  5. 安装插件谷歌地图:ionic cordova plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_IOS="your_api_key"
  6. ionic cordova platform add ios.
  7. ionic cordova prepare ios.
  8. ionic cordova debug ios.
  9. open xcode.
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56479314

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档