1
我遇到了一个问题,我正在开发一个使用phonegap的混合应用程序,并且客户希望能够打开本地地图(适用于iOS的Apple映射和适用于Android的Google Map)用标记,然后在完成时返回到应用程序。在Android上没关系,后退按钮已经实现,但是我的问题是针对iOS的。我已经开发了一个小插件来打开本地地图和地点标记用下面的代码:打开本地地图,然后回到应用程序phonegap
CDVPluginResult* pluginResult = nil;
NSNumber * latN = [command.arguments objectAtIndex:0];
NSNumber * lonN = [command.arguments objectAtIndex:1];
double lat = [latN doubleValue];
double lon = [lonN doubleValue];
CLLocationCoordinate2D myCoordinate = CLLocationCoordinate2DMake(lat, lon);
MKPlacemark *myPlacemark = [[[MKPlacemark alloc] initWithCoordinate:myCoordinate addressDictionary:nil]autorelease];
MKMapItem *mapItem = [[[MKMapItem alloc] initWithPlacemark:myPlacemark]autorelease];
mapItem.name = @"My car";
[mapItem openInMapsWithLaunchOptions:nil];
if (latN != nil && lonN != nil) {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@"ok"];
} else {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
}
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
有没有在iOS上执行这个办法? 在此先感谢, Med。