Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS unable to find plugins, Android fine

Tags:

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 = [   "Geolocation1841912763",   "Geolocation",   "getLocation",   [     false,     0   ] ] 

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> <feature name="NetworkStatus">     <param name="ios-package" value="CDVConnection" /> </feature> 

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.

like image 756
Mike Avatar asked Oct 18 '13 10:10

Mike


1 Answers

Mark's solution works but is unnecessary and will cause you to lose customizations to your XCode project.

What fixed it for me was:

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

like image 126
shi11i Avatar answered Oct 27 '22 16:10

shi11i