アプリがフォアグラウンドに入るときにラベルのテキストを変更しようとしていますが、常に取得します
致命的なエラー: オプション値のラップ解除中に予期せず nil が見つかりました
ViewController.swift
@IBOutlet var textLabel: UILabel!
func showLabel() {
textLabel.text = "Welcome back"
}
と
AppDelegate.swift
func applicationWillEnterForeground(application: UIApplication) {
ViewController().showLabel()
}
それを修正する方法はありますか?