firebase-ios-sdk: Crash in FIRAAppDelegateProxy application:openURL

[REQUIRED] Step 2: Describe your environment

  • Xcode version: 9.3
  • Firebase SDK version: Firebase/Core 4.10.1
  • Firebase Component: Core
  • Component versions:
    - FirebaseAnalytics (= 4.1.0)
    - FirebaseCore (= 4.0.17)
  - FirebaseAnalytics (4.1.0):
    - FirebaseCore (~> 4.0)
    - FirebaseInstanceID (~> 2.0)
    - GoogleToolboxForMac/NSData+zlib (~> 2.1)
    - nanopb (~> 0.3)
  - FirebaseCore (4.0.17):
    - GoogleToolboxForMac/NSData+zlib (~> 2.1)
  - FirebaseInstanceID (2.0.9):
    - FirebaseCore (~> 4.0)

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

Crash report received on Bugsnag. I can’t repro the issue.

Relevant Code:

      FirebaseApp.configure()

Stacktrace:


0  libswiftCore.dylib swift_getObjectType
1  Recharge           application (AppDelegate.swift)
2  Recharge           -[FIRAAppDelegateProxy application:openURL:sourceApplication:annotation:] (Recharge)
3  UIKit              ___58-[UIApplication _applicationOpenURLAction:payload:origin:]_block_invoke
4  UIKit              -[UIApplication _applicationOpenURLAction:payload:origin:]
5  UIKit              -[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:completion:]
6  UIKit              -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:]
7  UIKit              ___82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke
8  UIKit              -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]
9  UIKit              ___125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke
10 UIKit              __performActionsWithDelayForTransitionContext
11 UIKit              -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]
12 UIKit              -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:]
13 UIKit              -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:]
14 FrontBoardServices ___80-[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:]_block_invoke.362

I do have an implementation of func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) but I don’t see a call to it, which makes me think it’s something in the FIRAAppDelegateProxy that’s blowing up.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 23 (5 by maintainers)

Most upvoted comments

We had the same crashes and it’s related to a bug in swift 4.1 / XCode 9.3 reported here :

https://bugs.swift.org/browse/SR-7240?focusedCommentId=33771&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-33771

Our crashes were reproducible when opening a deep link.

And as @EmDee it was because we had implemented :

func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool

We just replaced it with :

func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool

That fixed our crashes. Hope it helps others.

We just had a very similar issue at our end. 100% reproducible as well.

Our issue happened due to authentication with the Facebook SDK (so probably similar to @jkmartin19’s issue). When logging in with the Facebook App (note: doesn’t happen when logging in through the Facebook website), the Facebook callback is most likely calling application(_:open:sourceApplication:annotation:), which then leads to the crash.

Our solution was simple: Just don’t implement application(_:open:sourceApplication:annotation:). It has been deprecated since iOS9 anyway. The Facebook SDK luckily has a replacement callback to application(_:open:options:).

Here’s our stack trace of the crash:

Thread 1 Queue : com.apple.main-thread (serial)
#0	0x0000000106c1faa4 in swift_getObjectType ()
#1	0x00000001028a86dc in @objc AppDelegate.application(_:open:sourceApplication:annotation:) ()
#2	0x0000000102edb068 in -[FIRAAppDelegateProxy application:openURL:sourceApplication:annotation:] ()
#3	0x000000018c770acc in __58-[UIApplication _applicationOpenURLAction:payload:origin:]_block_invoke ()
#4	0x000000018c770440 in -[UIApplication _applicationOpenURLAction:payload:origin:] ()
#5	0x000000018c38ce20 in -[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:completion:] ()
#6	0x000000018c355f04 in -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] ()
#7	0x000000018cfeb72c in __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke ()
#8	0x000000018c355268 in -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] ()
#9	0x000000018cdd09b8 in __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke ()
#10	0x000000018cf1eae8 in _performActionsWithDelayForTransitionContext ()
#11	0x000000018c354c88 in -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] ()
#12	0x000000018c354624 in -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] ()
#13	0x000000018c3923b0 in -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] ()
#14	0x0000000184fb8f24 in __80-[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:]_block_invoke.362 ()
#15	0x00000001074c5220 in _dispatch_client_callout ()
#16	0x00000001074d1850 in _dispatch_block_invoke_direct ()
#17	0x0000000184fec878 in __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ ()
#18	0x0000000184fec51c in -[FBSSerialQueue _performNext] ()
#19	0x0000000184fecab8 in -[FBSSerialQueue _performNextFromRunLoopSource] ()
#20	0x0000000182763404 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#21	0x0000000182762c2c in __CFRunLoopDoSources0 ()
#22	0x000000018276079c in __CFRunLoopRun ()
#23	0x0000000182680da8 in CFRunLoopRunSpecific ()
#24	0x0000000184663020 in GSEventRunModal ()
#25	0x000000018c66178c in UIApplicationMain ()
#26	0x00000001028ab624 in main at /FooBar/AppDelegate.swift:27
#27	0x0000000182111fc0 in start ()

@deguilardi As mentioned previously this issue is not related to Firebase at all.

You need to replace:

func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool

By:

func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool

If you need source and annotation you just need to get them from the options dictionary with the following keys UIApplicationOpenURLOptionsKey.sourceApplication and UIApplicationOpenURLOptionsKey. annotation

I had suspected the upgrade from Firebase 4.10.0 to 4.10.1 as the issue, so I downgraded back to 4.10.0, but the issue is still happening. Definitely doesn’t seem like an actual issue with Firebase SDK at this point, I’m just gonna upgrade to 4.12.0 and make a release with the above workaround. @paulb777 feel free to close this if you want? Thanks all!

Please note for those that can’t just remove that delegate call: In @LaurentLK’s link there is a very simple workaround fix, which I’ve seen in other people’s code as well, where you only have to change the annotation type from Any to Any?.

I got same issue.

xcode 9.2 (Swift4.0) is fine for firebaseSDK

xcode 9.3 build is ok, but when i run my app, got crash my podfile. pod ‘Firebase/Core’ pod ‘Firebase/Crash’ pod ‘Firebase/DynamicLinks’

I installed Installing Firebase (4.11.0) Installing FirebaseAnalytics (4.1.0) Installing FirebaseCore (4.0.18) Installing FirebaseCrash (2.0.2) Installing FirebaseDynamicLinks (2.3.2) Installing FirebaseInstanceID (2.0.10)

same relevant code FirebaseApp.configure()

I think firebase sdk not support for xcode9.3(swfit4.1). Same FIRAAppDelegateProxy issue

class AppDelegate: UIResponder, UIApplicationDelegate, UIAlertViewDelegate { this position got Thread1: EXC_BAD_ACCESS(code=1,…) crash.

bug trace

0 swift_getObjectType 25 UIApplicationMain 26 Main 27 start