firebase / firebase-ios-sdk

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

Firebase SDK crashes using CocoaPods dependencies - [FBLPromise HTTPBody]: unrecognized selector sent to instance #9441

Closed luisdelgado24 closed 2 years ago

luisdelgado24 commented 2 years ago

[REQUIRED] Step 1: Describe your environment

[REQUIRED] Step 2: Describe the problem

I've been following the instructions to add sign-in to my iOS app with FirebaseUI. I've already successfully added Firebase to my Xcode project, as well as added FirebaseUI to my Podfile and installed all the relevant pod dependencies. And lastly, I set up only the Google sign-in method, and added the respective handler for sign-in attempts within my AppDelegate.m. This is the only file where I have added code, so I'm not doing anything anywhere else. The issue is when I run my app, I'm crashing with a somewhat cryptic message [FBLPromise HTTPBody]: unrecognized selector sent to instance. I've seen other people having the same issue but no clear answer to what the solution is. I'm just trying to stand-up a basic view-controller with the Google sign-in option.

Crash dump

2022-03-10 18:03:01.913998-0800 Apartafit[83942:2604121] -[FBLPromise HTTPBody]: unrecognized selector sent to instance 0x600000cf5cb0
2022-03-10 18:03:01.915407-0800 Apartafit[83942:2604121] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FBLPromise HTTPBody]: unrecognized selector sent to instance 0x600000cf5cb0'
*** First throw call stack:
(
    0   CoreFoundation                      0x00000001803e1188 __exceptionPreprocess + 236
    1   libobjc.A.dylib                     0x0000000180193384 objc_exception_throw + 56
    2   CoreFoundation                      0x00000001803f0530 +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
    3   CoreFoundation                      0x00000001803e53fc ___forwarding___ + 1408
    4   CoreFoundation                      0x00000001803e743c _CF_forwarding_prep_0 + 92
    5   GoogleDataTransport                 0x000000010a1e9c9c -[GDTCCTUploadOperation updateNextUploadTimeWithResponse:forTarget:] + 76
    6   GoogleDataTransport                 0x000000010a1e918c __64-[GDTCCTUploadOperation sendURLRequestWithBatch:target:storage:]_block_invoke + 64
    7   FBLPromises         2022-03-10 18:03:01.947220-0800 Apartafit[83942:2603744] [Firebase/Crashlytics] Version 8.14.0
                0x0000000109a252c0 __56-[FBLPromise chainOnQueue:chainedFulfill:chainedReject:]_block_invoke.67 + 80
    8   FBLPromises                         0x0000000109a249d4 __44-[FBLPromise observeOnQueue:fulfill:reject:]_block_invoke_2 + 88
    9   libdispatch.dylib                   0x000000010abffe94 _dispatch_call_block_and_release + 24
    10  libdispatch.dylib                   0x000000010ac01694 _dispatch_client_callout + 16
    11  libdispatch.dylib                   0x000000010ac08a88 _dispatch_lane_serial_drain + 1300
    12  libdispatch.dylib                   0x000000010ac09534 _dispatch_lane_invoke + 436
    13  libdispatch.dylib                   0x000000010ac15664 _dispatch_workloop_worker_thread + 820
    14  libsystem_pthread.dylib             0x00000001c99caad4 _pthread_wqthread + 284
    15  libsystem_pthread.dylib             0x00000001c99c988c start_wqthread + 8
)
2022-03-10 18:03:01.976093-0800 Apartafit[83942:libc++abi: terminating with uncaught exception of type NSException

Relevant Code:

You can see my repo with all the files I have locally here

Below is what I have added in my AppDelegate.m, where the heavy-lifting is being done in the application:didFinishLaunchingWithOptions: API

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Use Firebase library to configure APIs
    [FIRApp configure];
    [FIRMessaging messaging].delegate = self;

    FUIAuth *authUI = [FUIAuth defaultAuthUI];
    // You need to adopt a FUIAuthDelegate protocol to receive callback
    authUI.delegate = self;

    NSArray<id<FUIAuthProvider>> *providers = @[
      [[FUIGoogleAuth alloc] initWithAuthUI:authUI],
    ];
    authUI.providers = providers;

    return YES;
}

#pragma mark - FUIAuthDelegate

- (BOOL)application:(UIApplication *)app
            openURL:(NSURL *)url
            options:(NSDictionary *)options {
  NSString *sourceApplication = options[UIApplicationOpenURLOptionsSourceApplicationKey];
  return [[FUIAuth defaultAuthUI] handleOpenURL:url sourceApplication:sourceApplication];
}

Thanks in advance for any insights!

paulb777 commented 2 years ago

@luisdelgado24 Sorry about the trouble. This might be an issue similar to #8536. Please take a look and if you're still stuck, share your Podfile and Podfile.lock.

luisdelgado24 commented 2 years ago

Hi Paul,

I see how the issue is similar to #8536 in that I am getting the "Class foo is implemented in both X and Y. One of the two will be used. Which one is undefined". But from what i see there, the conclusion is that it is problematic to link static frameworks into dynamic frameworks, and so the suggestion is to leverage use_frameworks! :linkage => :static in the podfile. I gave that a shot but I end up getting a linkage error because there are many duplicate symbols (below)

// long list of more duplicate symbols...
duplicate symbol '_OBJC_CLASS_$_FSTUserDataWriter' in:
    /Users/luisdelgado/Library/Developer/Xcode/DerivedData/Apartafit-dasqzxvesvnfteainizhstxqwldf/Build/Products/Debug-iphonesimulator/FirebaseFirestore.o
    /Users/luisdelgado/Library/Developer/Xcode/DerivedData/Apartafit-dasqzxvesvnfteainizhstxqwldf/Build/Products/Debug-iphonesimulator/FirebaseFirestore/FirebaseFirestore.framework/FirebaseFirestore(FSTUserDataWriter.o)
duplicate symbol '_OBJC_METACLASS_$_FSTUserDataWriter' in:
    /Users/luisdelgado/Library/Developer/Xcode/DerivedData/Apartafit-dasqzxvesvnfteainizhstxqwldf/Build/Products/Debug-iphonesimulator/FirebaseFirestore.o
    /Users/luisdelgado/Library/Developer/Xcode/DerivedData/Apartafit-dasqzxvesvnfteainizhstxqwldf/Build/Products/Debug-iphonesimulator/FirebaseFirestore/FirebaseFirestore.framework/FirebaseFirestore(FSTUserDataWriter.o)
ld: 889 duplicate symbols for architecture arm64

My online repo is https://github.com/luisdelgado24/Apartafit and the podfile is stored here . Any thoughts on what I could be doing wrong with my pod file?

paulb777 commented 2 years ago

The GitHub project integrates Firebase with both CocoaPods and Swift Package Manager. Only one can be used.

mmdock commented 2 years ago

I am also seeing a similar crash, I updated Firebase Crashlytics, Analytics, Performance, and RemoteConfig from 8.6.1 -> 8.13.0 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'

Screen Shot 2022-03-17 at 5 31 27 PM
google-oss-bot commented 2 years ago

Hey @luisdelgado24. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot commented 2 years ago

Since there haven't been any recent updates here, I am going to close this issue.

@luisdelgado24 if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.