firebase / firebase-ios-sdk

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

GoogleSignIn crash #8154

Closed Montura closed 3 years ago

Montura commented 3 years ago

[REQUIRED] Step 1: Describe your environment

[REQUIRED] Step 2: Describe the problem

iPad Air (3rd gen) running iOS 14.0.1

  1. App works fine when sign in with basic google account.
  2. App crashes when sign in with google workspace account.

Assertion failure in +[UIAlertAction _actionWithTitle:descriptiveText:image:style:handler:shouldDismissHandler:], UIAlertAction.m:42 2021-05-25 17:49:53.950251+0300 GoogleSignIn[16264:9133478] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Actions added to UIAlertController of style UIAlertActionStyleCancel must have a title when running in UIUserInterfaceIdiomPad'

Full backtrace is here (https://github.com/Montura/GoogleSignInDemo/blob/main/lldb_bt_all_log.txt)

P.S. It works fine on iOS-simulator

Steps to reproduce:

Login with credentials. There is a simple demo with Firebase 6.34.0 (https://github.com/Montura/GoogleSignInDemo)

The same problem was discussed here (https://github.com/firebase/firebase-ios-sdk/issues/6406)

Relevant Code:

// AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [FIRConfiguration.sharedInstance setLoggerLevel:FIRLoggerLevelWarning];
    [FIRApp configure];

    [FIRAnalytics setAnalyticsCollectionEnabled:true];

    GIDSignIn * gidSignIn = [GIDSignIn sharedInstance];
    gidSignIn.clientID = [FIRApp defaultApp].options.clientID;
    gidSignIn.delegate = self;

    // Override point for customization after application launch.
    return YES;
}

// ViewController.m
- (void)buttonPressed:(UIButton *)button {
    [GIDSignIn sharedInstance].presentingViewController = self;
    [[GIDSignIn sharedInstance] signIn];
}

[OPTIONAL] Step 3: The expected workflow

  1. To get an alert message when sign in with google workspace account image
google-oss-bot commented 3 years ago

I found a few problems with this issue:

morganchen12 commented 3 years ago

What version of GoogleSignIn are you using? Also, can you set an exception breakpoint and then print the stack trace again?

Montura commented 3 years ago

Version is 6.34.0. Also it crashes on version 8.0.0.

Full backtrack is here:

https://github.com/Montura/GoogleSignInDemo/blob/main/lldb_bt_all_log.txt

One more exception backtrace:

https://gist.github.com/kpilyugin/2af5a099eb6cade2e40b1c613c241382

morganchen12 commented 3 years ago

Can you share your full Podfile.lock? The code responsible for causing the crash no longer exists on the most recent version of GoogleSignIn (not Firebase). Note that GoogleSignIn is a separate CocoaPod and is versioned separately from Firebase.

Montura commented 3 years ago

I don't use any installations from (https://github.com/firebase/firebase-ios-sdk#installation) including CocaPods so I don't have a Podfile.lock.

I've just downloaded ZIP file from release (https://github.com/firebase/firebase-ios-sdk/releases/tag/8.0.0) and that is it.

GoogleSignIn is already bundled inside a Firebaze.zip

image

Then I set up manually Header Search Path and Framework search Path for the Xcode project.

image

Updated

I found all versions inside the Readme.md in the Firebaze.zip

GoogleSignIn version is 5.0.2.

CocoaPod Version
AppAuth 1.4.0
BoringSSL-GRPC 0.0.7
Firebase 8.0.0
FirebaseABTesting 8.0.0
FirebaseAnalytics 8.0.0
FirebaseAppCheck 8.0.0-beta
FirebaseAppDistribution 8.0.0-beta
FirebaseAuth 8.0.0
FirebaseCore 8.0.0
FirebaseCoreDiagnostics 8.0.0
FirebaseCrashlytics 8.0.0
FirebaseDatabase 8.0.0
FirebaseDynamicLinks 8.0.0
FirebaseFirestore 8.0.0
FirebaseFunctions 8.0.0
FirebaseInAppMessaging 8.0.0-beta
FirebaseInstallations 8.0.0
FirebaseMLModelDownloader 8.0.0-beta
FirebaseMessaging 8.0.0
FirebasePerformance 8.0.0
FirebaseRemoteConfig 8.0.0
FirebaseStorage 8.0.0
GTMAppAuth 1.2.1
GTMSessionFetcher 1.5.0
Google-Mobile-Ads-SDK 8.4.1
GoogleAppMeasurement 8.0.0
GoogleDataTransport 9.0.0
GoogleSignIn 5.0.2
GoogleUserMessagingPlatform 2.0.0
GoogleUtilities 7.4.0
PromisesObjC 1.2.12
Protobuf 3.15.8
SwiftProtobuf 1.16.0
abseil 0.20200225.0
gRPC-C++ 1.28.2
gRPC-Core 1.28.2
leveldb-library 1.22.1
nanopb 2.30908.0
Montura commented 3 years ago

@morganchen12, I found the problem. There is a GoogleSignIn.Bundle inside FirebaseSDK. I've added it into the Frameworks group in the app. Then everything works fine!

It seems GoogleSignIn try to get some string from GoogleSignIn.bundle in runtime and got NULL when there is no the bundle.

image

image

sainttail commented 3 years ago

@Montura

I don't think this is the my problem but based on your finding I think I found the root problem in my comment #8164(Comment)

paulb777 commented 3 years ago

@Montura Thanks for sharing your solution. Note that this should be covered by Step 7 in the Zip README:

7. If the SDK has resources, go into the Resources folders, which will be in
   the SDK folder. Drag all of those resources into the Project Navigator, just
   like the frameworks, again making sure that the target you want to add these
   resources to has a checkmark next to it, and that you've selected "Copy items
   if needed".