在两个嵌套子类中调用super.viewDidLoad()时,我遇到了一个Swift的无限循环 [英] I'm getting an infinite loop with Swift when calling super.viewDidLoad() in two nested subclasses
问题描述
我正在使用一个用Swift编写的iOS应用程序。我有一个UITabBarController的子类,然后一个嵌套的子类:
I'm working on an iOS app written in Swift. I have a subclass of UITabBarController, and then a nested subclass:
class HWTabBarController: UITabBarController {
override func viewDidLoad() {
super.viewDidLoad()
...
}
}
class MainTabBarController: HWTabBarController {
override func viewDidLoad() {
super.viewDidLoad()
...
}
}
b $ b
这在iOS模拟器中正常工作,甚至当我在我的iPhone上调试应用程序时。
但是当我归档应用程序并将其发送到我的手机与TestFlight它崩溃。
This works fine in the iOS simulator, and even when I'm debugging the app on my iPhone. But it crashes when I archive the app and send it to my phone with TestFlight.
我的崩溃日志充满了无限循环:
My crash logs are filled with this infinite loop:
22 HDWR 0x00145e10 @objc HDWR.MainTabBarController.viewDidLoad (HDWR.MainTabBarController)() -> () (MainTabBarController.swift:16)
23 HDWR 0x00262867 NRMA__voidParamHandler
24 HDWR 0x0014ea00 HDWR.HWTabBarController.viewDidLoad (HDWR.HWTabBarController)() -> () (HWTabBarController.swift:24)
25 HDWR 0x00145e10 @objc HDWR.MainTabBarController.viewDidLoad (HDWR.MainTabBarController)() -> () (MainTabBarController.swift:16)
26 HDWR 0x00262867 NRMA__voidParamHandler
27 HDWR 0x0014ea00 HDWR.HWTabBarController.viewDidLoad (HDWR.HWTabBarController)() -> () (HWTabBarController.swift:24)
28 HDWR 0x00145e10 @objc HDWR.MainTabBarController.viewDidLoad (HDWR.MainTabBarController)() -> () (MainTabBarController.swift:16)
29 HDWR 0x00262867 NRMA__voidParamHandler
30 HDWR 0x0014ea00 HDWR.HWTabBarController.viewDidLoad (HDWR.HWTabBarController)() -> () (HWTabBarController.swift:24)
31 HDWR 0x00145e10 @objc HDWR.MainTabBarController.viewDidLoad (HDWR.MainTabBarController)() -> () (MainTabBarController.swift:16)
32 HDWR 0x00262867 NRMA__voidParamHandler
33 HDWR 0x0014ea00 HDWR.HWTabBarController.viewDidLoad (HDWR.HWTabBarController)() -> () (HWTabBarController.swift:24)
voidParamHandler
指令,为什么会导致 MainTabBarController.viewDidLoad
?
What's the voidParamHandler
instruction, and why does it lead back to MainTabBarController.viewDidLoad
?
这里?或者这是Swift中的错误?
Am I doing something wrong here? Or is this a bug in Swift?
推荐答案
您使用 New Relic 在您的应用程序? (我猜所有的 NRMA__voidParamHandler
引用你是)我有这个确切的问题。我禁用了New Relic SDK和从Testflight下载的构建停止崩溃。我还没有报告错误,但你/我/我们可能应该。
Are you using New Relic in your app? (I'm guessing from all those NRMA__voidParamHandler
references that you are.) I had this exact problem. I disabled the New Relic SDK and builds downloaded from Testflight stopped crashing. I haven't reported a bug yet, but you/I/we probably should.
这篇关于在两个嵌套子类中调用super.viewDidLoad()时,我遇到了一个Swift的无限循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!