我正在使用此代码获取当前位置想要使用此信息进行共享,例如 whatsapp。在共享位置按钮上点击我想将纬度和经度发送给其他用户。但它显示完全不同的位置
CLLocationManager *lm = [[CLLocationManager alloc] init];
lm.delegate = self;
lm.desiredAccuracy = kCLLocationAccuracyBest;
lm.distanceFilter = kCLDistanceFilterNone;
[lm startUpdatingLocation];
CLLocation *location = [lm location];
CLLocationCoordinate2D coord = [location coordinate] ;
Class mapItemClass = [MKMapItem class];
if (mapItemClass && [mapItemClass respondsToSelector:@selector(openMapsWithItems:launchOptions:)])
{
// Create an MKMapItem to pass to the Maps app
CLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake(coord.longitude, coord.latitude);
MKPlacemark *placemark = [[MKPlacemark alloc] initWithCoordinate:coordinate addressDictionary:nil];
MKMapItem *mapItem = [[MKMapItem alloc] initWithPlacemark:placemark];
[mapItem setName:@"My Place"];
// Pass the map item to the Maps app
[mapItem openInMapsWithLaunchOptions:nil];
}
是否有可能像 whatsapp 一样显示附近的街道或地名来分享。