Property 'keyWindow' not found on object of type 'UIWindowScene *'

Viewed 306

When attempting to build a flutter app via xcode, this is an error I am getting, which a semantic issue and a part of "GoogleSignIn". The application was working fine until I implemented an alternative method for users to sign in (google sign in). I know that my implementation is correct because it works flawlessly on an Android emulator (Windows laptop), but has issues running on a Mac. Any ideas as to what might be the problem? Here is the code snippet to which the error points to:

// This method is exposed to the unit test.
- (nullable UIWindow *)keyWindow {
  if (@available(iOS 15, *)) {
    for (UIScene *scene in UIApplication.sharedApplication.connectedScenes) {
      if ([scene isKindOfClass:[UIWindowScene class]] &&
          scene.activationState == UISceneActivationStateForegroundActive) {
        return ((UIWindowScene *)scene).keyWindow;
      }
    }
  }
0 Answers
Related