Skip to content

[google_sign_in_ios] FLTGoogleSignInPlugin has analyzer warning when run against iOS 14: nil passed to a callee that requires a non-null 2nd parameter #153587

@jmagman

Description

@jmagman

flutter/packages#7431

/Volumes/Work/s/w/ir/x/w/packages/packages/google_sign_in/google_sign_in_ios/darwin/Classes/FLTGoogleSignInPlugin.m:310:16: warning: nil passed to a callee that requires a non-null 2nd parameter [nullability.NullPassedToNonnull]
  310 |     completion([FSIUserData makeWithDisplayName:user.profile.name
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  311 |                                           email:user.profile.email
      |                                           ~~~~~~~~~~~~~~~~~~~~~~~~
  312 |                                          userId:user.userID
      |                                          ~~~~~~~~~~~~~~~~~~
  313 |                                        photoUrl:[photoUrl absoluteString]
      |                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  314 |                                  serverAuthCode:serverAuthCode
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  315 |                                         idToken:idToken],
      |                                         ~~~~~~~~~~~~~~~~
1 warning generated.

https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8739424034971101873/+/u/Run_package_tests/xcode_analyze_deprecation/stdout

You can see this by running:

$ dart run script/tool/bin/flutter_plugin_tools.dart xcode-analyze "--ios-min-version=14.0" --ios
    args: ["xcode-analyze", "--ios", "--ios-min-version=14.0"]

https://github.com/flutter/packages/blob/e11be1a82a60d418dd628f2dc1662a5c6690696a/.ci/targets/ios_platform_tests.yaml#L21

Code is here:
https://github.com/flutter/packages/blob/e11be1a82a60d418dd628f2dc1662a5c6690696a/packages/google_sign_in/google_sign_in_ios/darwin/Classes/FLTGoogleSignInPlugin.m#L310-L316

I don't think this is actually causing any bugs, but the pattern here is a little off: the GIDSignInResult should be checked for nil, then the error handled.
https://github.com/flutter/packages/blob/e11be1a82a60d418dd628f2dc1662a5c6690696a/packages/google_sign_in/google_sign_in_ios/darwin/Classes/FLTGoogleSignInPlugin.m#L155-L166

    [self signInWithHint:nil
        additionalScopes:self.requestedScopes.allObjects
              completion:^(GIDSignInResult *_Nullable signInResult, NSError *_Nullable error) {
                GIDGoogleUser *user;
                NSString *serverAuthCode;
                if (signInResult) {
                  user = signInResult.user;
                  serverAuthCode = signInResult.serverAuthCode;
                }

                [self didSignInForUser:user
                    withServerAuthCode:serverAuthCode
                            completion:completion
                                 error:error];
              }];

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectp: google_sign_inThe Google Sign-In pluginpackageflutter/packages repository. See also p: labels.team-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions