mikemike mikemike - 1 year ago 90
iOS Question

iOS unable to find plugins, Android fine

I am building an app in Phonegap/Cordova. App is fairly simple at the moment, but does require the network status and geolocation plugins to work.

I've developed the app so far (it's made up of just a few basic HTML pages and a bit of JS at the moment) on Android and it has been working fine.

This morning I decided to make sure all was well with iOS. To absolutely no surprise at all, it isn't.

So... it appears to be a problem with the plugins. XCode spits out the following:

CDVPlugin class CDVLocation (pluginName: Geolocation) does not exist.
2013-10-18 11:24:29.437 Eye Cab[589:907] ERROR: Plugin 'Geolocation' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
2013-10-18 11:24:29.438 Eye Cab[589:907] -[CDVCommandQueue executePending] [Line 117] FAILED pluginJSON = [

I guess this means it can't load the Geolocation plugin. I get a similar thing for the network connection plugin.

Below is my truncated config.xml from the Phonegap project:

<feature name="http://api.phonegap.com/1.0/device" />
<feature name="Geolocation">
<param name="ios-package" value="CDVLocation" />
<feature name="NetworkStatus">
<param name="ios-package" value="CDVConnection" />

I have also tried using the IDs as the feature name (eg. org.apache.cordova.geolocation), but get the same problem. The exact same error in fact.

Everything works perfectly in Android; in the simulator, in Chrome on my mac and on a device.

I am using the following versions:

  • Phonegap 3.1.0-0.15.0

  • XCode 5.0

  • OSX 10.8.5

  • iOS 6.1.3 (iPod Touch)

  • iOS Simulator for iOS 7

The correct files are in the /www/plugins/ folder in the project:

  • org.apache.cordova.geolocation

    • www

      • Coordinates.js

      • Position.js

      • PositionError.js

      • geolocation.js

  • org.apache.cordova.network-information

    • www

      • Connection.js

      • network.js

An elated hug for anyone who can help with this. I've trawled through the other questions but with no luck.

Answer Source

iOS was missing the plugin files themselves (.m and .h files), which must be copied by calling cordova prepare or phonegap prepare. Not very well documented it seems.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download