2017-10-26 16 views
0

MapPinAnnotationは私がラベルにテキストを設定したいが、後述のようにエラーを取得致命的なエラーを取得:オプションの値をアンラップ

var lblNotificationCount:UILabel! 

を定義しているMKAnnotationタイプのクラスである一方で、予想外にnilを見つける: -

let storeAnnotation = annotation as! MapPinAnnotation 

enter image description here

とコンソールに私はcountの値を取得することができていますが、それは以下のようにエラーを印刷: -

コンソール出力:

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をチェックしてください。 –

関連する問題