firebase / firebase-ios-sdk

Firebase SDK for Apple App Development
https://firebase.google.com
Apache License 2.0
5.53k stars 1.44k forks source link

Sign in alert shown inconsistently when triggered in viewDidAppear #8096

Closed lfkellogg closed 1 year ago

lfkellogg commented 3 years ago

[REQUIRED] Step 1: Describe your environment

[REQUIRED] Step 2: Describe the problem

Steps to reproduce:

  1. Create a new Project, choose the "App" template, then set Interface to Storyboard
  2. Follow the docs to set up the SDK in the "Basic" configuration, calling checkForUpdate from viewDidAppear
  3. Run the app on a device running iOS 13+
  4. [Optional] If the "Enable new build alerts" alert is shown on launch, kill the app from the app switcher and re-launch it

Expected behavior: on first launch and on subsequent launches before signing in, the SDK should show the "Enable new build alerts" alert.

Actual behavior: It is inconsistent. Often the alert will show up on first launch, but not on subsequent launches. Sometimes not even on first launch.

Relevant Code:

Debugging the SDK locally, the issue appears to be with this line: https://github.com/firebase/firebase-ios-sdk/blob/f920f2feaad50aa7d6a196e956574b21fcab927a/FirebaseAppDistribution/Sources/FIRAppDistributionUIService.m#L208

Sometimes, the scene has not become active by the time viewDidAppear is called. In that case we do not find a foreground scene here, and the alert cannot be shown. This is illustrated by a workaround where checkForUpdate is triggered from the SceneDelegate's sceneDidBecomeActive instead.

google-oss-bot commented 3 years ago

I found a few problems with this issue:

tejasd commented 1 year ago

This has been fixed for single scene apps in Firebase SDK version: 10.1.0