我正在制作一个iOS应用程序,告诉用户包围洗车点,当我在模拟器上运行时,它工作正常,另一方面当我在真实设备上运行时,地图不显示注释,没有委托功能调用map,我使用的是iOS 6.1和x code 5
- (void)nextGeocodeRequest
{
// if we're done, dp whatever you want
NSMutableDictionary* htc = nil;
htc=[[NSMutableDictionary alloc] init];
if ([addressesMArray count] == 0)
{
// do whatever you want when we're done (e.g. open maps)
[spinner stopAnimating];
[spinner setHidesWhenStopped:YES];
// NSLog(@"array %@",mutableCoordinatesArray);
//NSLog(@"array address in geocoded %@",mutableCoordinatesArray);
return;
}
NSLog(@"array count %lu",(unsigned long)addressesMArray.count);
NSDictionary *dicSingleRecore = [addressesMArray objectAtIndex:0];
NSString *strTitle=[dicSingleRecore objectForKey:@"s_title"];
//NSString *strSubTitle=[dicSingleRecore objectForKey:@"s_address"];
NSString *strArrayAddressSingle=[dicSingleRecore objectForKey:@"s_address"];
NSString *strCity=[dicSingleRecore objectForKey:@"s_city"];
NSString *strCountry=[dicSingleRecore objectForKey:@"s_country"];
NSString *address=[NSString stringWithFormat:@"%@,%@,%@",strArrayAddressSingle,strCity,strCountry];
NSLog(@"address to geocoded %@",address);
[addressesMArray removeObjectAtIndex:0];
[geocoder geocodeAddressString:address completionHandler:^(NSArray *placemarks, NSError *error) {
if(placemarks.count>0)
{
//NSLog(@"Found placemarks for %@",[htc objectForKey:kAddressKey]);
placemark = [placemarks objectAtIndex:0];
MapPoint *annotation = [[MapPoint alloc]
initWithName:strTitle
address:@""
coordinate:placemark.location.coordinate] ;
[mapView addAnnotation:annotation];
[htc setObject:[NSNumber numberWithDouble:placemark.location.coordinate.latitude] forKey:@"lat"];
[htc setObject:[NSNumber numberWithDouble:placemark.location.coordinate.longitude] forKey:@"long"];
}else {
NSLog(@"Address not recognized: ");
}
[mutableCoordinatesArray addObject:htc];
[self nextGeocodeRequest];
}];
NSLog(@"mutableCoordinatesArray %@ ",mutableCoordinatesArray);
}