을 위해 내가 라벨에 텍스트를 변경하기 위해 노력하고있어 발견됩니다applicationWillEnterForeground 앱 전경를 입력하지만 난 항상 얻을 때 전무가 textLabel라는
치명적인 오류 : 예기치 않게 발견하는 옵션 값을 풀기 동안 전무
ViewController.swift
@IBOutlet var textLabel: UILabel!
func showLabel() {
textLabel.text = "Welcome back"
}
및
AppDelegate.swift
func applicationWillEnterForeground(application: UIApplication) {
ViewController().showLabel()
}
어떤 문제를 해결하는 방법?
가 해당 뷰 컨트롤러가 을로드 뷰 했습니까? – Wain
가능한 복제본 [didBecomeActive()에서 선택 값을 래핑하지 않을 때] (http://stackoverflow.com/questions/28016699/nil-when-unwrapping-an-optional-value-in-didbecomeactive) –
옙 이것이 내 것이 었습니다. 해결책 : http://stackoverflow.com/questions/28016699/nil-when-unwrapping-an-optional-value-in-didbecomeactive하지만 이전에 찾지 못했습니다. 오늘 질문했습니다 – chrisco