iOS 找不到插件,Android 没问题 [英] iOS unable to find plugins, Android fine

查看:33
本文介绍了iOS 找不到插件,Android 没问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Phonegap/Cordova 中构建应用程序.应用程序目前相当简单,但需要网络状态和地理定位插件才能工作.

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.

到目前为止,我已经在 Android 上开发了该应用程序(目前它仅由几个基本的 HTML 页面和一些 JS 组成)并且运行良好.

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.

今天早上我决定确保 iOS 一切正常.毫不奇怪,事实并非如此.

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

所以...插件似乎有问题.XCode 吐出以下内容:

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
  ]
]

我猜这意味着它无法加载 Geolocation 插件.我在网络连接插件上得到了类似的结果.

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

以下是我截取的 Phonegap 项目中的 config.xml:

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>

我也尝试过使用 ID 作为功能名称(例如 org.apache.cordova.geolocation),但遇到了同样的问题.实际上完全相同的错误.

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.

一切都在 Android 中完美运行;在模拟器中,在我的 Mac 和设备上的 Chrome 中.

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

我正在使用以下版本:

  • Phonegap 3.1.0-0.15.0
  • XCode 5.0
  • OSX 10.8.5
  • iOS 6.1.3 (iPod Touch)
  • 适用于 iOS 7 的 iOS 模拟器

正确的文件位于项目的/www/plugins/文件夹中:

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

  • org.apache.cordova.geolocation
    • www
      • 坐标.js
      • Position.js
      • PositionError.js
      • geolocation.js
      • 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.

        推荐答案

        iOS 缺少插件文件本身(.m 和 .h 文件),必须通过调用 cordova prepare 或 <代码>phonegap 准备.似乎没有很好的记录.

        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.

        这篇关于iOS 找不到插件,Android 没问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆