IBOutlet在viewDidLoad中是零

时间:2015-10-10 17:04:28

标签: ios iphone swift

我有一个快速的应用程序被App Review拒绝,因为它在发布时崩溃了。

我象征着崩溃报告,发现了这个:

...
OS Version:          iOS 9.0.2 (13A452)
...
Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000048
Triggered by Thread:  0
...
Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   myappname                   0x00000001000d88e8 specialized NetworkDiagramViewController.viewDidLoad() -> () (NetworkDiagramViewController.swift:117)
1   myappname                   0x00000001000d77a4 @objc NetworkDiagramViewController.viewDidLoad() -> () (NetworkDiagramViewController.swift:0)
2   UIKit                           0x000000018b7af610 -[UIViewController loadViewIfRequired] + 1124
...

以下是NetworkDiagramViewController.swift的相关部分:

...
11: class NetworkDiagramViewController: UIViewController {
12: 
13:    @IBOutlet weak var serverLabel: UILabel!
...
29:    override func viewDidLoad() {
30:        super.viewDidLoad()
31:        updateCloudViews()
32:    }
...
116:   private func updateCloudViews() {
117:       serverLabel.text = ServerSettings.host ?? " "
118:   }
...

我已经仔细检查过serverLabel插座是否正确连接在故事板中。这种崩溃永远不会发生在我的任何测试设备或模拟器中。

0 个答案:

没有答案