I'm getting an infinite loop with Swift when calling super.viewDidLoad() in two nested subclasses

谁说我不能喝 提交于 2019-12-04 07:48:06

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.

with the addition of swift all the sweet dynamic function look-ups objective-c has is done away. To get that functionality back you'll need to add the "dynamic" declaration flag to all methods that New Relic instruments.

Like this:

class HWTabBarController: UITabBarController {
    override dynamic func viewDidLoad() {
        super.viewDidLoad()
        ...
    }
}

class MainTabBarController: HWTabBarController {
    override dynamic func viewDidLoad() {
        super.viewDidLoad()
        ...
    }
}

More details, including which functions this includes, here: https://docs.newrelic.com/docs/mobile-monitoring/new-relic-mobile/getting-started/enabling-swift-interaction-traces

I just downloaded the repo, signed it on my own profile and everything seemed to work as you have it programmed. No infinite loop, no crashing. This is through Test Flight as well. This leads me to believe that you have some errors somewhere on your system. I suggest doing a few things...

  1. Cleaning your build cmd+alt+shift+k && deleting the app on your phone.
  2. Closing Xcode then deleting your derived data. (If you haven't done this before I can expand on how to do it.)
  3. Registering it as a new app on test flight if practical.

My idea is that it will help when you delete your derived data but I would do it all just so you know everything is clean. Again, I did not encounter this problem at any stage: simulator, direct install from Xcode or download via Test Flight.

Also make sure the bundle ID is registered correctly and all is well server-side on Test Flight. I can't imagine why it would cause a loop but this is a strange situation so let's see what happens. :^)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!