Phonegap(Cordova)2.7.0 + Mapkit插件+入门 [英] Phonegap (Cordova) 2.7.0 + Mapkit Plugin + Getting Started

查看:137
本文介绍了Phonegap(Cordova)2.7.0 + Mapkit插件+入门的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试取得 PhoneGap Mapkit外挂程式

这是我到目前为止所做的:

This is what I did so far:


  1. 我将 MapKit框架添加到了我的xcodeproject:

  1. I added the MapKit framework into my xcodeproject:

Framework/
  MapKit.framework
  ...


  • 已下载并添加了 MapKit 插件原生文件插入到plugins文件夹:

  • Downloaded and added MapKit plugin native files to the plugins folder:

    Plugins/
       AsyncImageView.h
       AsyncImageView.m
       CDVAnnotation.h
       CDVAnnotation.m
       MapKit.h
       MapKit.m
    


  • 已下载并添加了 JSONKit 插件原生文件到插件文件夹:

  • Downloaded and added JSONKit plugin native files to the plugins folder:

    Plugins/
       ...
       JSONKit.h
       JSONKit.m
    


  • 已下载并添加了 MapKit.js

    www/js/
       MapKit.js
       ...
    


  • 包含 MapKit.js 文件:

    ...
    <script type="text/javascript" src="cordova-2.7.0.js"></script>
    <script type="text/javascript" src="js/MapKit.js"></script>
    <script type="text/javascript" src="js/index.js"></script>
    ...
    


  • config.xml file:

    ...
    <widget>
      ...
      <plugins>
        ...
        <plugin name="MapKitView" value="MapKitView" />
      </plugins>
      <access origin="*" />
    </widget>
    


  • 添加了 showMap 我的应用程序对象在 js / index.js 文件中:

  • Added a showMapfunction to my app object in the js/index.js file:

    var app = {
      ...
      onDeviceReady: function() {
        app.showMap();
      },
      showMap: function(){
        window.plugins.mapKit.showMap();
        window.plugins.mapKit.setMapData({
              buttonCallback: function(){
                alert(arguments[0]);
              },
              height: 360,
              diameter: 1000,
              offsetTop: 25,
              lat: pins[0].lat,
              lon: pins[0].lon
           });
        window.plugins.mapKit.addMapPins([{
                lat:49.281468,
                lon:-123.104446,
                title:"Nitobi HQ",
                pinColor:"purple",
                selected:true
           }]);
      }
    }
    


  • 运行后,没有发生任何事情。没有地图错误...

    After running this nothing happens. No Map no Errors...

    控制台输出

    Console Output

    -> Multi-tasking -> Device: YES, App: YES
    -> Resetting plugins due to page load.
    -> Finished load of: file:///..pathto../iPhone%20Simulator/6.0/Applications/...SOMEKEY.../PhoneGapIOSExample.app/www/index.html
    -> DEPRECATION NOTICE: The Connection ReachableViaWWAN return value of '2g' is deprecated as of Cordova version 2.6.0 and will be changed to 'cellular' in a future release. 
    

    我缺少什么?

    推荐答案

    编辑:
    cordova 2.7.0不能再用于提交应用程序到苹果商店,所以我删除了我的插件插件。

    cordova 2.7.0 can't be used anymore to submit apps to the apple store, so I deleted my fork of the plugin.

    对于较新的cordova版本,请使用
    https://github.com / wf9a5m75 / phonegap-googlemaps-plugin

    For newer cordova versions use https://github.com/wf9a5m75/phonegap-googlemaps-plugin

    可以找到原始插件此处

    这篇关于Phonegap(Cordova)2.7.0 + Mapkit插件+入门的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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