ios 找不到Phonegap 3.0 IOS插件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18403225/
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:50:25  来源:igfitidea点击:

Phonegap 3.0 IOS plugins not found

ioscordova

提问by m1crdy

I′m getting this error in XCode:

我在 XCode 中收到此错误:

2013-08-23 14:36:18.284 Tell The DJ[14955:c07] ERROR: Plugin 'Device' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
2013-08-23 14:36:18.284 Tell The DJ[14955:c07] -[CDVCommandQueue executePending] [Line 116] FAILED pluginJSON = [
  "Device1096677259",
  "Device",
  "getDeviceInfo",
  [

  ]
]
2013-08-23 14:36:18.285 Tell The DJ[14955:c07] CDVPlugin class CDVConnection (pluginName: NetworkStatus) does not exist.
2013-08-23 14:36:18.285 Tell The DJ[14955:c07] ERROR: Plugin 'NetworkStatus' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
2013-08-23 14:36:18.285 Tell The DJ[14955:c07] -[CDVCommandQueue executePending] [Line 116] FAILED pluginJSON = [
  "NetworkStatus1096677260",
  "NetworkStatus",
  "getConnectionInfo",
  [

  ]
]

I installed Phonegap 3.0 with the Command Line Interface and paste my www files into the project folders. The app works fine but when i come to native functions like device ID, camera, network connections it fails and gets me this error. But I think my config.xml is right?

我使用命令行界面安装了 Phonegap 3.0 并将我的 www 文件粘贴到项目文件夹中。该应用程序运行良好,但是当我使用设备 ID、相机、网络连接等本机功能时,它会失败并出现此错误。但我认为我的 config.xml 是对的?

<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.helloCordova" version="2.0.0" xmlns="http://www.w3.org/ns/widgets">
    <name>Hello Cordova</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="[email protected]" href="http://cordova.io">
        Apache Cordova Team
    </author>
    <content src="index.html" />
    <feature name="LocalStorage">
        <param name="ios-package" value="CDVLocalStorage" />
    </feature>
    <access origin="http://dev.tellthedj.de" />
    <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="orientation" value="portrait" />
    <preference name="webviewbounce" value="false" />
    <preference name="prerendered-icon" value="true" />
    <preference name="phonegap-version" value="3.0.0" />
    <preference name="fullscreen" value="false" />
    <preference name="stay-in-webview" value="false" />
    <preference name="android-minSdkVersion" value="7" />
    <preference name="android-installLocation" value="internalOnly" />
    <preference name="target-device" value="universal" />
    <preference name="autohide-splashscreen" value="true" />
    <preference name="load-url-timeout" value="60000" />
    <preference name="show-splashscreen-spinner" value="true" />
    <preference name="show-splash-screen-spinner" value="true" />
    <preference name="allow-inline-media-playback" value="false" />
    <preference name="launch-mode" value="standard" />
    <feature name="Media">
        <param name="ios-package" value="CDVSound" />
    </feature>
    <feature name="Camera">
        <param name="ios-package" value="CDVCamera" />
    </feature>
    <feature name="Console">
        <param name="ios-package" value="CDVLogger" />
    </feature>
    <feature name="Device">
        <param name="ios-package" value="CDVDevice" />
    </feature>
    <feature name="Notification">
        <param name="ios-package" value="CDVNotification" />
    </feature>
    <feature name="File">
        <param name="ios-package" value="CDVFile" />
    </feature>
    <feature name="FileTransfer">
        <param name="ios-package" value="CDVFileTransfer" />
    </feature>
    <feature name="Geolocation">
        <param name="ios-package" value="CDVLocation" />
    </feature>
    <feature name="Capture">
        <param name="ios-package" value="CDVCapture" />
    </feature>
    <feature name="NetworkStatus">
        <param name="ios-package" value="CDVConnection" />
    </feature>
    <feature name="SplashScreen">
        <param name="ios-package" value="CDVSplashScreen" />
    </feature>
    <plugins>
        <plugin name="Device" value="CDVDevice" />
    </plugins>
</widget>

回答by Jeffrey Van Alstine

I was using PhoneGap 3.0/3.1 and was removing the local build folder before rebuilding (since I had to copy icons and stuff in a secondary build script). This broke my plugins and produced this same error message.

我正在使用 PhoneGap 3.0/3.1 并在重建之前删除本地构建文件夹(因为我必须在辅助构建脚本中复制图标和内容)。这破坏了我的插件并产生了相同的错误消息。

In the end I found I had to remove ./plugins/ios.jsonwhen removing ./platforms/iosto make sure the plugins were rebuilt.

最后我发现我必须在删除./plugins/ios.json时删除./platforms/ios以确保重新构建插件。

回答by bjunix

Deleting the platforms/ios folder is not a solution for meas all manual customizations to the xcode project will be lost.

删除platforms/ios 文件夹对我来说不是一个解决方案,因为所有对xcode 项目的手动自定义都将丢失。

But there is a simple way around:

但是有一个简单的方法:

In XCode, goto Build Phases -> open the Compiled Sources dropdown. Click + and add the missing plugin .m file that should be in your Plugins directory (but is missing from the compiled sources).

在 XCode 中,转到 Build Phases -> 打开 Compiled Sources 下拉列表。单击 + 并添加应该在您的 Plugins 目录中的缺失插件 .m 文件(但在编译源中缺失)。

This solution came from another stack overflow answer, here: https://stackoverflow.com/a/21148428/80254

这个解决方案来自另一个堆栈溢出答案,在这里:https: //stackoverflow.com/a/21148428/80254

Another alternative:

另一种选择:

In xcode make sure the source files of the plugin has the 'target membership' settings set: In File-Explorer go to Plugins > CDVDevice.m and check if there is a tick next to your app name at "target membership" on the right side of xcode window. This actually does the same as the other solution but is a bit more convenient.

在 xcode 中,确保插件的源文件设置了“目标成员资格”设置:在文件资源管理器中,转到插件 > CDVDevice.m 并检查右侧“目标成员资格”处的应用名称旁边是否有勾号xcode 窗口的一侧。这实际上与其他解决方案相同,但更方便一些。

From here: https://stackoverflow.com/a/20576744/80254

从这里:https: //stackoverflow.com/a/20576744/80254

回答by Kobkrit Viriyayudhakorn

I encountered the same issue. I have followed the solution given by Jeffrey Van Alstine. This is my script for building and testing an iOS app developed using Phonegap 3.0/3.1.

我遇到了同样的问题。我遵循了 Jeffrey Van Alstine 给出的解决方案。这是我用于构建和测试使用 Phonegap 3.0/3.1 开发的 iOS 应用程序的脚本。

#!/bin/bash
echo "Killing xcode..."
kill $(ps aux | grep 'Xcode' | awk '{print }')
rm -r platforms/ios
rm plugins/ios.json
phonegap build ios
open platforms/ios/*.xcodeproj

Save it as a bash file, for example, ios.shinto your working directory (directory that contains wwwfolder) and run ./ios.sh

将它保存为 bash 文件,例如,ios.sh到您的工作目录(包含www文件夹的目录)中并运行./ios.sh

回答by gsharp999

This seems to be a known issue for 3.* versions

这似乎是 3.* 版本的已知问题

https://issues.apache.org/jira/browse/CB-4971

https://issues.apache.org/jira/browse/CB-4971

you can solve this by upgrading Phonegap to release 3.4.

您可以通过将 Phonegap 升级到 3.4 版来解决此问题。

回答by Rob Rodriguez

Try reinstalling the plugin:

尝试重新安装插件:

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

phonegap 本地插件添加https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git

回答by mareks

I use Cordova 3.7 and I solved the problem with Kobkrit Viriyayudhakorn 's solution, BUT of course you need to use

我使用 Cordova 3.7,我用 Kobkrit Viriyayudhakorn 的解决方案解决了这个问题,但当然你需要使用

cordova build ios    

instead of

代替

phonegap build ios    

回答by matb33

When this happens, it seems the xcode npm package responsible for making changes to the pbxproj file sometimes leaves references to plugin files that have been removed. I have not tracked down under what exact circumstances this occurs, but it appears to happen from frequent plugin remove/add operations (to update a plugin for example).

发生这种情况时,似乎负责更改 pbxproj 文件的 xcode npm 包有时会留下对已删除插件文件的引用。我还没有追踪到底是在什么情况下发生这种情况,但它似乎是由于频繁的插件删除/添加操作(例如更新插件)而发生的。

I suspect that when a plugin is removed and the xcode npm package fails at its job, it is only able to remove the plugin file references from the PBXBuildFile section but no other sections, leaving the pbxproj in a broken state.

我怀疑当插件被删除并且 xcode npm 包在其工作中失败时,它只能从 PBXBuildFile 部分中删除插件文件引用,而不能从其他部分中删除,从而使 pbxproj 处于损坏状态。

When the xcode npm package attempts to add the plugin file references again, it first checks if the references are already in pbxproj. It looks in the PBXFileReference section, and since it finds references to the plugin in there, aborts further processing, getting us nowhere.

当 xcode npm 包再次尝试添加插件文件引用时,它首先检查引用是否已经在 pbxproj 中。它查看 PBXFileReference 部分,因为它在那里找到了对插件的引用,所以会中止进一步的处理,使我们无处可去。

My solution, albeit a hack when it comes down to it, is to force the xcode npm package to check the PBXBuildFile section instead. That section will be missing the references and in turn the plugin will be re-installed correctly.

我的解决方案是强制 xcode npm 包检查 PBXBuildFile 部分,尽管它归结起来是一个黑客。该部分将缺少参考资料,反过来插件将被正确重新安装。

Change pbxFileReferenceSectionto pbxBuildFileSectionon this line: https://github.com/alunny/node-xcode/blob/master/lib/pbxProject.js#L620

更改pbxFileReferenceSectionpbxBuildFileSection这一行:https: //github.com/alunny/node-xcode/blob/master/lib/pbxProject.js#L620

Re-install your plugins, and you should be good to go.

重新安装你的插件,你应该很高兴。

回答by Mayur

I my case After install Paypal Plugin I am facing issue.

我的情况 安装 Paypal 插件后,我遇到了问题。

I resolved its by add "PayPalMobileCordovaPlugin.m" in the Compile Source.

我通过在编译源中添加“PayPalMobileCordovaPlugin.m”来解决它。

So you just need to add .m file in Compile source add it works for me.

所以你只需要在编译源中添加 .m 文件添加它对我有用。

Check Screenshot.Screenshot After Add .m File

检查屏幕截图。添加 .m 文件后的屏幕截图

Hope its work for you

希望它对你有用

回答by TechnoTim

This can also happen if you have a plugin that is referenced but not installed. If you have tried the above solutions and can't find the referenced plugin's .m file it might be that the plugin isn't really installed.

如果您有一个被引用但未安装的插件,也会发生这种情况。如果您尝试了上述解决方案但找不到引用的插件的 .m 文件,则可能是该插件并未真正安装。

I would check your plugins directory to be sure that there are files in it. If not, reinstall the plugin. I ran into this when I had a typo in the git repo when restoring plugins from the config.xml.

我会检查您的插件目录以确保其中有文件。如果没有,请重新安装插件。当我在从 config.xml 恢复插件时在 git repo 中有一个错字时,我遇到了这个问题。

回答by steph

i think you need to use the correct config.xml for me, it is Xcode project target folder config.xml, and not platform www folder

我认为您需要为我使用正确的 config.xml,它是 Xcode 项目目标文件夹 config.xml,而不是平台 www 文件夹