Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
676 views
Welcome To Ask or Share your Answers For Others

1 Answer

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...