简体   繁体   English

找不到Cordova iOS插件

[英]Cordova iOS plugins not found

I recently upgraded to Cordova 2.9.0 from 2.3.0. 我最近从2.3.0升级到Cordova 2.9.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: 但是,在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>

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)'目标成员资格'设置包含我的应用程序名称。

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插件

I had the same issue. 我遇到过同样的问题。 I just downloaded the cordova 3.0 command line tool using node's package manager. 我刚刚使用node的包管理器下载了cordova 3.0命令行工具。 I then used the tool from Terminal to create my project, add platforms to it, and build it like this. 然后我使用Terminal中的工具创建我的项目,为其添加平台,并像这样构建它。

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. 在此之后,当我试图在模拟器中运行它时,我在Xcode中看到了相同的错误。 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. 现在默认情况下,PhoneGap似乎不包含项目中的任何插件,因此即使在配置文件中,它们也可能不在插件文件夹中。 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. 我使用命令行工具,因为我觉得它更容易。

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. 这样做后,我再次在模拟器中运行myApp,一切正常。 There are some good instructions on the command line tool here: 这里有一些关于命令行工具的好的说明:

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. 我想如果PhoneGap 3.0需要Logger,Device和Network Status它会自动包含这些插件,但在我的情况下却没有。 Hope this helps. 希望这可以帮助。

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. 编辑:在Xcode的iOS版config.xml中,您还需要进行此更改以使Logger插件正常工作。 The following is the default. 以下是默认值。

<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. 现在你的所有控制台功能都可以运行而不会出错。

I was having the same issue with the device information plugin using Phonegap 3.0.0. 我使用Phonegap 3.0.0时遇到了与设备信息插件相同的问题。 To solve this I simply had to uninstall and reinstall the plugin and then rebuild my project. 要解决这个问题,我只需卸载并重新安装插件,然后重建我的项目。

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

I went back to using the old <plugin> format. 我回去使用旧的<plugin>格式。 Although it is deprecated, it's the only way that works for me. 虽然它已被弃用,但它是唯一适合我的方式。

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

Came across this issue myself. 我自己遇到过这个问题。 Found the only solution was running cordova prepare after adding the plugins via CLI. 发现唯一的解决方案是在通过CLI添加插件后运行cordova prepare prepare copies the necessary files across to the XCode project within the platforms folder. prepare将必要的文件复制到platforms文件夹中的XCode项目。

I think this should be done as part of the build command, or the plugin add command if the project is present. 我认为这应该作为build命令的一部分完成,或者如果项目存在则执行plugin add命令。 Maybe it's a bug, maybe it's deliberate, but I couldn't find much documentation on it. 也许这是一个错误,也许是故意的,但我找不到很多文档。

Similar question with answers . 类似的问题与答案

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设置 - 但它解决了这个问题。

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>

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. 我只是自己创建了目录(platforms / ios / appname / Plugins / org.apache.cordova.console)并将丢失的文件(CDVLLogger.h和CDVLLogger.m)复制到此目录中。 Then the compilation went through successfully. 然后编译成功完成。

I am using cordova version 3.5 我使用的是cordova 3.5版

If you get this error using Ionic then trying running cordova run ios --device instead of ionic run ios --device It fixed the issue for me. 如果你使用Ionic得到这个错误然后尝试运行cordova run ios --device而不是ionic run ios --device它为我解决了这个问题。 I think the Ionic cli v2 was messing things up since the project was an Ionic 1 project. 由于该项目是Ionic 1项目,我认为Ionic cli v2搞砸了。 I had no issues before updating the Ionic cli. 在更新Ionic cli之前我没有遇到任何问题。

I had the very same problem with the SQLitePlugin. 我遇到了与SQLitePlugin相同的问题。 I tried some of the proposed solutions in this post but none of them exactly worked for me. 我在这篇文章中尝试了一些提议的解决方案,但它们都没有对我有用。 Then I tried to remove the platform/ios dir (I am developing for an iPhone), added the ios platform again (ionic add platform ios) and rebuilt the project. 然后我尝试删除平台/ ios目录(我正在为iPhone开发),再次添加ios平台(离子添加平台ios)并重建项目。 Suddenly, everything worked like a charm. 突然间,一切都像魅力一样。 I didn't had to create a new project nor had to remove the plugins. 我没有必要创建一个新项目,也不必删除插件。

We opened the project in Xcode, and looked in the Project navigator sidebar. 我们在Xcode中打开了项目,并查看了Project导航器侧边栏。

Under the virtual "Plugins" folder we noticed that the files for some plugins were missing from this folder. 在虚拟的“插件”文件夹下,我们注意到该文件夹​​中缺少某些插件的文件。

侧栏中的Plugins文件夹包含一些插件文件

The solution was to right-click on Plugins and select Add Files to "ProjectName"... 解决方案是右键单击Plugins并选择Add Files to“ProjectName”...

Then we navigated into the plugin's folder and added all the .swift and .m and .h files there. 然后我们导航到插件的文件夹,并在.swift添加了所有.swift.m.h文件。

Doing this created new references in the file platforms/ios/[ProjectName].xcodeproj/project.pbxproj so we kept those changes. 这样做会在文件platforms/ios/[ProjectName].xcodeproj/project.pbxproj创建新的引用,所以我们保留了这些更改。

For new cordova versions 适用于新的cordova版本

Mass Saving of Plugins on an Existing Project 在现有项目中大量节省插件

If you have a pre-existing project and you want to save all currently added plugins in the project, you can use: 如果您有一个预先存在的项目,并且想要在项目中保存所有当前添加的插件,则可以使用:

cordova plugin save

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM