0

I am trying to find out what is the cause of a black screen that a comparatively small set of users are facing. Most of them are coming from the background. The app uses ReSwift for data refreshing, although that does not trigger the re run of the didFinishLaunchingWithOptions. I also thought might be OOM (Out Of Memory), but if I provoque it and test it, the app just crashes. For what is worth, I have also observed that is happening to 6s and SE (2nd edition) users. What can I try next?

This is the code that runs on changing its status:

func applicationWillEnterForeground(_ application: UIApplication) {
    let internetConnectionStatus = InternetConnectionStatus()
    _ = internetConnectionStatus.isOk().subscribe(onNext: { connected in
        if !connected {
            self.showFloatr(withBody: "ctkit.error.no-internet")
        }
    })
}

func applicationDidBecomeActive(_ application: UIApplication) {
   
    if let keyWindow = UIApplication.shared.keyWindow,
       keyWindow.rootViewController is AuthPasswordRecoveryViewController ||
       keyWindow.rootViewController is AuthNavigationViewController {
        return
    }
    UIApplication.shared.applicationIconBadgeNumber = 0
    UIApplication.shared.registerForRemoteNotifications()
}

The affected users are running iOS 15.

halfer
  • 19,824
  • 17
  • 99
  • 186
Inigo Llamosas
  • 457
  • 1
  • 4
  • 12
  • 1
    `InternetConnectionStatus` is a local instance, which will get deallocated soon as the function call ends. You probably need to hold on to a reference to `InternetConnectionStatus` within your class, so that callbacks execute properly. Besides that, are you able to consistently recreate it the issue? Does it still happen with debugger attached? With attached debugger, is `applicationWillEnterForeground` called?Add a breakpoint on `viewWillAppear` on whichever view controller you know is active and see if it gets there. Without knowing the exact structure of your app, its hard to debug. – mani Aug 16 '22 at 15:10
  • Thanks for the help. Correct about the InternetConnectionStatus remark, although I don't think it will fix the issue. No, the biggest problem is that I cannot reproduce the issue no matter what. But yes, applicationWillEnterForeground and applicationDidBecomeActive are called, I have already tested that – Inigo Llamosas Aug 16 '22 at 17:50
  • Do you have access to a device on which this seems to happen a lot? Lookup device logs (https://developer.apple.com/documentation/xcode/acquiring-crash-reports-and-diagnostic-logs) and see if anything interesting is happening there, add some log statements. Because its intermittent and more apparent on older devices, could be some sort of deadlock, network connection or too much work on main thread issue with some async code that doesn't fulfil as quickly as needed. – mani Aug 17 '22 at 06:27

0 Answers0