问题
I am trying to get the PhoneGap Mapkit Plugin up and running.
This is what I did so far:
I added the MapKit framework into my xcodeproject:
Framework/ MapKit.framework ...
Downloaded and added MapKit plugin native files to the plugins folder:
Plugins/ AsyncImageView.h AsyncImageView.m CDVAnnotation.h CDVAnnotation.m MapKit.h MapKit.m
Downloaded and added JSONKit plugin native files to the plugins folder:
Plugins/ ... JSONKit.h JSONKit.m
Downloaded and added MapKit.js:
www/js/ MapKit.js ...
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> ...
Added the Plugin to the
config.xml
file:... <widget> ... <plugins> ... <plugin name="MapKitView" value="MapKitView" /> </plugins> <access origin="*" /> </widget>
Added a
showMap
function to my app object in thejs/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