Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phonegap 3.0 IOS plugins not found

Tags:

ios

cordova

I´m getting this error in 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?

<?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>
like image 635
m1crdy Avatar asked Aug 23 '13 12:08

m1crdy


3 Answers

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.

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

like image 92
Jeffrey Van Alstine Avatar answered Nov 08 '22 19:11

Jeffrey Van Alstine


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

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).

This solution came from another stack overflow answer, here: 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.

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

like image 33
bjunix Avatar answered Nov 08 '22 17:11

bjunix


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.

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

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

like image 17
Kobkrit Viriyayudhakorn Avatar answered Nov 08 '22 17:11

Kobkrit Viriyayudhakorn