열거 형에 액세스하려고 시도하지만 작동하지 않습니다. 열거 형 - 예기되지 않은 선택기가 인스턴스에 전송되었습니다.
typedef enum
{
AnnotationTypeMale = 0,
AnnotationTypeFemale = 1
} AnnotationType;
@interface Annotation : NSObject <MKAnnotation>
{
CLLocationCoordinate2D coordinate;
NSString *title;
NSString *subtitle;
AnnotationType annotation_type;
}
@property (nonatomic) CLLocationCoordinate2D coordinate;
@property (nonatomic,retain) NSString *title;
@property (nonatomic,retain) NSString *subtitle;
@property (nonatomic,getter=getAnnotationType,setter=setAnnotationType) AnnotationType annotation_type;
@end
이 내 Annotation.h이었고, 내 Annotation.mi에 ...
내가 내 Annotation.h의 형식 정의 열거하고 내가 열거의 하나의 요소에 액세스하기 위해 다른 클래스에서 시도 합성 모든 그리고 난 내가 AnnotationType에 액세스하려면 지금하려고 내 다른 클래스 ... 또한 Annotation.h ... 을 포함
문 나던 오류가 발생 work..this 경우 생성
- (AnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id)annotation
{
AnnotationView *annotationView = nil;
// determine the type of annotation, and produce the correct type of annotation view for it.
Annotation* myAnnotation = (Annotation *)annotation;
if([myAnnotation getAnnotationType] == AnnotationTypeMale)
{
: 인해 캐치되지 않는 예외 응용 프로그램 종료 ' NSInvalidArgumentException ', reason :'- [MKUserLocation getAnnotationTyp e] : 인스턴스에 보낸 인식 할 수없는 선택기 0x5c43850 '
모든 솔루션 ?????? thx
안녕을! !! !! 고마워요 4 귀하의 게시물에 문제가 고정되어 :) – Kun19
첫 번째 솔루션을했다;) – Kun19