找不到 Cordova iOS 插件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17384523/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 00:08:32  来源:igfitidea点击:

Cordova iOS plugins not found

iosxcodecordova

提问by bjudson

I recently upgraded to Cordova 2.9.0 from 2.3.0. After following all the upgrade instructions, I was able to get the app to launch in the simulator. However, in Xcode I see the following errors:

我最近从 2.3.0 升级到 Cordova 2.9.0。按照所有升级说明进行操作后,我能够在模拟器中启动应用程序。但是,在 Xcode 中,我看到以下错误:

ERROR: Plugin 'Device' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
-[CDVCommandQueue executePending] [Line 103] FAILED pluginJSON = ["Device1776032119","Device","getDeviceInfo",[]]
ERROR: Plugin 'NetworkStatus' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
-[CDVCommandQueue executePending] [Line 103] FAILED pluginJSON = ["NetworkStatus1776032120","NetworkStatus","getConnectionInfo",[]]
-[CDVCommandQueue executePending] [Line 103] FAILED pluginJSON = ["INVALID","Logger","logLevel",["LOG","deviceready has not fired after 5 seconds."]]
ERROR: Plugin 'Logger' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
-[CDVCommandQueue executePending] [Line 103] FAILED pluginJSON = ["INVALID","Logger","logLevel",["LOG","Channel not fired: onCordovaConnectionReady"]]
ERROR: Plugin 'Logger' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
-[CDVCommandQueue executePending] [Line 103] FAILED pluginJSON = ["INVALID","Logger","logLevel",["LOG","Channel not fired: onCordovaInfoReady"]]

This is my config.xml file:

这是我的 config.xml 文件:

<?xml version="1.0" encoding="UTF-8"?>
<widget>
    <feature name="Geolocation">
        <param name="ios-package" value="CDVLocation" />
    </feature>
    <feature name="Device">
        <param name="ios-package" value="CDVDevice" />
    </feature>
    <feature name="Accelerometer">
        <param name="ios-package" value="CDVAccelerometer" />
    </feature>
    <feature name="Compass">
        <param name="ios-package" value="CDVLocation" />
    </feature>
    <feature name="Media">
        <param name="ios-package" value="CDVSound" />
    </feature>
    <feature name="Camera">
        <param name="ios-package" value="CDVCamera" />
    </feature>
    <feature name="Contacts">
        <param name="ios-package" value="CDVContacts" />
    </feature>
    <feature name="File">
        <param name="ios-package" value="CDVFile" />
    </feature>
    <feature name="NetworkStatus">
        <param name="ios-package" value="CDVConnection" />
    </feature>
    <feature name="Notification">
        <param name="ios-package" value="CDVNotification" />
    </feature>
    <feature name="FileTransfer">
        <param name="ios-package" value="CDVFileTransfer" />
    </feature>
    <feature name="Capture">
        <param name="ios-package" value="CDVCapture" />
    </feature>
    <feature name="Battery">
        <param name="ios-package" value="CDVBattery" />
    </feature>
    <feature name="SplashScreen">
        <param name="ios-package" value="CDVSplashScreen" />
    </feature>
    <feature name="Echo">
        <param name="ios-package" value="CDVEcho" />
    </feature>
    <feature name="Globalization">
        <param name="ios-package" value="CDVGlobalization" />
    </feature>
    <feature name="InAppBrowser">
        <param name="ios-package" value="CDVInAppBrowser" />
    </feature>
    <feature name="Logger">
        <param name="ios-package" value="CDVLogger" />
    </feature>
    <feature name="LocalStorage">
        <param name="ios-package" value="CDVLocalStorage" />
    </feature>
    <plugins>
    </plugins>
    <preference name="KeyboardDisplayRequiresUserAction" value="true" />
    <preference name="SuppressesIncrementalRendering" value="false" />
    <preference name="UIWebViewBounce" value="true" />
    <preference name="TopActivityIndicator" value="gray" />
    <preference name="EnableLocation" value="false" />
    <preference name="EnableViewportScale" value="false" />
    <preference name="AutoHideSplashScreen" value="true" />
    <preference name="ShowSplashScreenSpinner" value="true" />
    <preference name="MediaPlaybackRequiresUserAction" value="false" />
    <preference name="AllowInlineMediaPlayback" value="false" />
    <preference name="OpenAllWhitelistURLsInWebView" value="false" />
    <preference name="BackupWebStorage" value="cloud" />
    <preference name="fullscreen" value="true" />
    <preference name="webviewbounce" value="true" />
    <access origin="*.googleapis.com"/>
    <access origin="*.gstatic.com"/>
    <access origin="*.s3.amazonaws.com"/>
</widget>

回答by Paul

For future searchers (like me!), I had a similar problem trying to add the console plugin to my project. The missing step for me after installing the plugin was to make sure the source files of the plugin (CDVlogger.m) 'target membership' settings included my application names.

对于未来的搜索者(像我一样!),我在尝试将控制台插件添加到我的项目时遇到了类似的问题。安装插件后我缺少的步骤是确保插件的源文件 (CDVlogger.m) '目标成员资格'设置包括我的应用程序名称。

回答by Ska

Similar question with answer that worked for me:

类似问题的答案对我有用:

remove ./plugins/ios.json to make sure the plugins are rebuilt.

删除 ./plugins/ios.json 以确保重新构建插件。

Phonegap 3.0 IOS plugins not found

找不到Phonegap 3.0 IOS插件

回答by Robert-W

I had the same issue. I just downloaded the cordova 3.0 command line tool using node's package manager. I then used the tool from Terminal to create my project, add platforms to it, and build it like this.

我遇到过同样的问题。我刚刚使用 node 的包管理器下载了cordova 3.0命令行工具。然后我使用终端中的工具来创建我的项目,向其中添加平台,并像这样构建它。

cordova create myApp com.project.RobertW myApp
cd myApp
cordova platform add ios
cordova platform add android
cordova build

After this I saw those same errors in Xcode when I tried to run it in the simulator. It seems by default now PhoneGap does not include any plugins in the project so even if there in your config file they probably won't be in the plugins folder. You have to add them manually or via the command line tool. I used the command line tool because I thought it was easier like so.

在此之后,当我尝试在模拟器中运行它时,我在 Xcode 中看到了同样的错误。默认情况下,PhoneGap 现在似乎在项目中不包含任何插件,因此即使在您的配置文件中,它们也可能不会在 plugins 文件夹中。您必须手动或通过命令行工具添加它们。我使用命令行工具是因为我认为这样更容易。

cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information.git
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-console.git
cordova build

After doing this I ran myApp in the simulator again and everything worked fine. There are some good instructions on the command line tool here:

完成此操作后,我再次在模拟器中运行 myApp,一切正常。这里有一些关于命令行工具的很好的说明:

http://docs.phonegap.com/en/3.0.0/guide_cli_index.md.html#The%20Command-line%20Interface

http://docs.phonegap.com/en/3.0.0/guide_cli_index.md.html#The%20Command-line%20Interface

I would like to think if PhoneGap 3.0 needs Logger, Device, and Network Status that it would include those plugins automatically but in my case it did not. Hope this helps.

我想如果 PhoneGap 3.0 需要记录器、设备和网络状态,它会自动包含这些插件,但在我的情况下它没有。希望这可以帮助。

Edit: In the config.xml for iOS version in Xcode, you'll also need to make this change to get the Logger plugin to work correctly. The following is the default.

编辑:在 Xcode 中 iOS 版本的 config.xml 中,您还需要进行此更改以使 Logger 插件正常工作。以下是默认设置。

<feature name="Console">
    <param name="ios-package" value="CDVLogger" />
</feature>

Change above to this

上面改成这个

<feature name="Logger">
    <param name="ios-package" value="CDVLogger" />
</feature>

Now all your console functions should work without throwing errors.

现在您的所有控制台功能都应该可以正常工作而不会引发错误。

回答by Max

I was having the same issue with the device information plugin using Phonegap 3.0.0. To solve this I simply had to uninstall and reinstall the plugin and then rebuild my project.

我在使用 Phonegap 3.0.0 的设备信息插件上遇到了同样的问题。为了解决这个问题,我只需要卸载并重新安装插件,然后重建我的项目。

phonegap local plugin remove org.apache.cordova.device
phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
phonegap local build ios

回答by bjudson

I went back to using the old <plugin>format. Although it is deprecated, it's the only way that works for me.

我回到使用旧<plugin>格式。虽然它已被弃用,但它是唯一对我有用的方法。

<plugins>
    <plugin name="Device" value="CDVDevice" />
    <plugin name="Logger" value="CDVLogger" />
    ...
</plugins>

回答by Mike

Came across this issue myself. Found the only solution was running cordova prepareafter adding the plugins via CLI. preparecopies the necessary files across to the XCode project within the platformsfolder.

自己遇到了这个问题。cordova prepare通过 CLI 添加插件后发现唯一的解决方案是运行。 prepare将必要的文件复制到文件platforms夹内的 XCode 项目。

I think this should be done as part of the buildcommand, or the plugin addcommand if the project is present. Maybe it's a bug, maybe it's deliberate, but I couldn't find much documentation on it.

我认为这应该作为build命令的一部分完成,或者plugin add如果项目存在则作为命令的一部分。也许这是一个错误,也许是故意的,但我找不到太多关于它的文档。

Similar question with answers.

类似的问题有答案

回答by etwina

happened to me on phonegap 3.5 with Xcode 6

使用 Xcode 6 在 phonegap 3.5 上发生在我身上

steps:

脚步:

phonegap plugin remove org.apache.cordova.camera 
phongap plugin add org.apache.cordova.camera 
phongap platform remove ios
phongap build ios

Probably not the best solution - because you lose your xcode settings - But it fixed the problem.

可能不是最好的解决方案 - 因为你丢失了 xcode 设置 - 但它解决了这个问题。

回答by xhinoda

In my case...the solution was add this line of code for all plugin that i use.. in my config.xml

在我的情况下......解决方案是为我使用的所有插件添加这行代码......在我的config.xml中

    <feature name="Device">
    <param name="ios-package" value="CDVDevice" />
    <param name="onload" value="true" />
</feature>

<feature name="FCMPlugin">
    <param name="ios-package" value="FCMPlugin" />
    <param name="onload" value="true" />
</feature>

<feature name="StatusBar">
    <param name="ios-package" value="CDVStatusBar" />
    <param name="onload" value="true" />
</feature>

<feature name="CDVLocation">
    <param name="ios-package" value="CDVLocation" />
    <param name="onload" value="true" />
</feature>

<feature name="cordova.logger">
    <param name="ios-package" value="CDVLogger" />
    <param name="onload" value="true" />
</feature>

<feature name="Logger">
    <param name="ios-package" value="CDVLogger" />
    <param name="onload" value="true" />
</feature>

<feature name="Console">
    <param name="ios-package" value="CDVLogger" />
    <param name="onload" value="true" />
</feature>


<feature name="SQLitePlugin">
    <param name="ios-package" value="SQLitePlugin" />
    <param name="onload" value="true" />
</feature>

  <feature name="Keyboard">
    <param name="ios-package" value="IonicKeyboard" />
    <param name="onload" value="true" />
</feature>

回答by Jens

I also had this problem. I simply created the directory myself (platforms/ios/appname/Plugins/org.apache.cordova.console) and copied the missing files (CDVLLogger.h and CDVLLogger.m) to this directory. Then the compilation went through successfully.

我也有这个问题。我只是自己创建了目录(platforms/ios/appname/Plugins/org.apache.cordova.console)并将丢失的文件(CDVLLogger.h 和 CDVLLogger.m)复制到这个目录。然后编译就顺利通过了。

I am using cordova version 3.5

我正在使用cordova 3.5版

回答by Hyman Vial

If you get this error using Ionic then trying running cordova run ios --deviceinstead of ionic run ios --deviceIt fixed the issue for me. I think the Ionic cli v2 was messing things up since the project was an Ionic 1 project. I had no issues before updating the Ionic cli.

如果您使用 Ionic 遇到此错误,则尝试运行cordova run ios --device而不是ionic run ios --device它为我解决了问题。我认为 Ionic cli v2 把事情搞砸了,因为该项目是一个 Ionic 1 项目。在更新 Ionic cli 之前我没有遇到任何问题。