2017-10-26 3 views
0

MapPinAnnotation는 아래에 설명 된대로 내가 라벨에 텍스트하지만 점점 오류를 설정할 치명적인 오류를 가져 오기 :

var lblNotificationCount:UILabel! 

를 정의하는 MKAnnotation 타입의 클래스 선택 사양 값을 풀기 동안 예기치 않게 전무을 발견 : -

let storeAnnotation = annotation as! MapPinAnnotation 

enter image description here

와 콘솔에 내가 계수의 값을 얻을 수 있어요하지만, 아래로 인쇄 오류 : -

콘솔 출력 :

Count: 1 
fatal error: unexpectedly found nil while unwrapping an Optional value 

이 문제를 해결하는 방법, 도와주세요. 미리 감사드립니다.

+0

는 .text = 문자열 (수) ...하지 작업, – GayashanK

+0

@cerberus을 시도합니다. –

답변

0

이 도움이 될 수 있습니다

storeAnnotation.lblNotificationCount.text = String(describing: count) 
+0

여전히 같은 오류가 발생합니다. 작동 안함. –

+0

레이블에 대해 IBOutlet을 확인하십시오. –

관련 문제