Phonegap (Cordova) 2.7.0 + Mapkit Plugin + Getting Started

自作多情 提交于 2019-12-11 01:26:03

问题


I am trying to get the PhoneGap Mapkit Plugin up and running.

This is what I did so far:

  1. I added the MapKit framework into my xcodeproject:

    Framework/
      MapKit.framework
      ...
    
  2. Downloaded and added MapKit plugin native files to the plugins folder:

    Plugins/
       AsyncImageView.h
       AsyncImageView.m
       CDVAnnotation.h
       CDVAnnotation.m
       MapKit.h
       MapKit.m
    
  3. Downloaded and added JSONKit plugin native files to the plugins folder:

    Plugins/
       ...
       JSONKit.h
       JSONKit.m
    
  4. Downloaded and added MapKit.js:

    www/js/
       MapKit.js
       ...
    
  5. Included the MapKit.js file in the index.html:

    ...
    <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>
    ...
    
  6. Added the Plugin to the config.xml file:

    ...
    <widget>
      ...
      <plugins>
        ...
        <plugin name="MapKitView" value="MapKitView" />
      </plugins>
      <access origin="*" />
    </widget>
    
  7. 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. 

What am I missing?


回答1:


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

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

The original plugin can be found here



来源:https://stackoverflow.com/questions/16811642/phonegap-cordova-2-7-0-mapkit-plugin-getting-started

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!