지도보기를로드 중입니다. 주소록에있는 주소록을 기반으로지도에 핀을 추가하고 있습니다. 일부 핀 (어쩌면 2 개 중 2 개)이지도보기에 표시되지 않는 이상한 경우가 있습니다. 유효한 주소를 확인했습니다. 하지만 핀이 떨어지는 것은 아닙니다. 이것에 대한 이유는 무엇 일 수 있습니다.PC에 비해 모바일 장치에 표시되는 핀의 수가 제한되어 있습니다.
for (i = 0; i<[groupContentArray count]; i++) {
person = ABAddressBookGetPersonWithRecordID(addressbook,[[groupContentArray objectAtIndex:i] intValue]);
ABMultiValueRef addressProperty = ABRecordCopyValue(person, kABPersonAddressProperty);
NSArray *address = (NSArray *)ABMultiValueCopyArrayOfAllValues(addressProperty);
NSLog(@"Address %@", address);
for (NSDictionary *addressDict in address)
{
addAnnotation = nil;
firstName = (NSString *)ABRecordCopyValue(person, kABPersonFirstNameProperty);
lastName = (NSString *)ABRecordCopyValue(person, kABPersonLastNameProperty);
NSString *country = [addressDict objectForKey:@"Country"];
NSString *streetName = [addressDict objectForKey:@"Street"];
NSString *cityName = [addressDict objectForKey:@"City"];
NSString *stateName = [addressDict objectForKey:@"State"];
if (streetName == (id)[NSNull null] || streetName.length == 0) streetName = @"";
if (stateName == (id)[NSNull null] || stateName.length == 0) stateName = @"";
if (cityName == (id)[NSNull null] || cityName.length == 0) cityName = @"";
if (country == (id)[NSNull null] || country.length == 0) country = @"";
NSString *fullAddress = [streetName stringByAppendingFormat:@"%@/%@/%@", cityName, stateName, country];
mapCenter = [self getLocationFromAddressString:fullAddress];
if(stateName != NULL || country != NULL || streetName != NULL || cityName != NULL){
if ((mapCenter.latitude == 0) && (mapCenter.longitude == 0))
{
// Alert View
}
else{
addAnnotation = (MyAddressAnnotation *)[mapView dequeueReusableAnnotationViewWithIdentifier:[groupContentArray objectAtIndex:i]];
if(addAnnotation == nil){
addAnnotation = [[[MyAddressAnnotation alloc] initWithCoordinate:mapCenter title:firstName SubTitle:lastName Recordid:[groupContentArray objectAtIndex:i] ]autorelease];
[mapView addAnnotation:addAnnotation];}
}
}
}
CFRelease(addressProperty);
}
편집 : 내 질문을 편집하며 구체적으로 작성합니다. 코드를 사용하여 mapView의 핀을 삭제합니다. 내 Mac PC에서지도에 20 개의 핀을 떨어 뜨리면됩니다. 모든 20 핀은 정확하게 떨어지고 잘 작동합니다. 그러나 IPhone이나 IPad를 사용할 때 핀 수가 대폭 줄어 듭니다. 즉, 내가 떨어지는 20 개의 핀 중 4 개의 핀만지도에 표시됩니다. 나는이 이유를 알 수 없다.
코딩의 일부분을 보여줄 수 있습니까? – HarshIT
코드가 없어도 무엇이 잘못되었는지를 말하기는 불가능합니다. 즉, 코드와 같은 정보를 좀 더 제공하십시오. – Manuel
해들리와 완전히 동의합니다 ... 코드화 된 것을 제공하십시오. – Krunal