2016-10-18 2 views
0

내가 코드표현 'ID <MKAnnotation>'

- (void)pinDropped { 
StoreData *myStore = [StoreData sharedStore]; 

for (NSUInteger i = 0; i < annotations.count; i++) { 

    MapViewController *ann = [[_mapView annotations] objectAtIndex:i]; 

    NSString *myStoreString = [NSString stringWithFormat:@"%@", myStore.myUebergabe]; 
    NSString *myAnnTitleString = [NSString stringWithFormat:@"%@", ann.title]; 


    if ([myStoreString isEqual:myAnnTitleString]) { 
     [_mapView selectAnnotation:[_mapView.annotations objectAtIndex:i] animated:YES]; 

    } 

} }이 조각이 * 앤에서 엑스 코드에서이 경고를 생성

:

Initializing 'MapViewController *__strong' with an expression of incompatible type 'id<MKAnnotation>' 

을 어떻게하면이 경고를 없앨 수 있습니까? 경고에도 불구하고 모든 것이 잘 작동합니다.

올바른 방향으로 나를 안내해 주셔서 대단히 감사합니다. 마틴

답변

0

변경이 :

MapViewController *ann = [[_mapView annotations] objectAtIndex:i]; 

에 :

id<MKAnnotation> ann = [[_mapView annotations] objectAtIndex:i]; 

[_mapView annotations] 이후 수익률 id<MKAnnotation의 배열이 아닌 MapViewController의 배열입니다.