プログラミングスクール最大70%OFF! ←クリックして見に行く

【Warning】Swift Compiler Warning:Treating a forced downcast to ‘NSDictionary’ as optional will never produce ‘nil’

【Warning】Swift Compiler Warning:Treating a forced downcast to ‘NSDictionary’ as optional will never produce ‘nil’

エラー解消方法の備忘録_φ(・_・ )

発生したエラー

Treating a forced downcast to ‘NSDictionary’ as optional will never produce ‘nil’

翻訳

‘NSDictionary’への強制ダウンキャストをオプションとして扱うと、 ‘nil’が生成されることはありません。

原因

nilを許すキャストの場合は、as?を使う

解決手順

as! → as?

参考サイト

http://ios-dev.seesaa.net/article/409532965.html
https://stackoverflow-com.translate.goog/questions/24223605/treating-a-forced-downcast-as-optional-will-never-produce-nil?_x_tr_sl=en&_x_tr_tl=ja&_x_tr_hl=ja&_x_tr_pto=sc

Swiftカテゴリの最新記事