### [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:
```SIGSEGV: Attempted to dereference null pointer.
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.
Maybe worth noting: I just released the version of our app that upgrades to Firebase/Core 4.10.1 this morning. The crash has happened three times, to two separate users. I tried testing out our deep link support and it works fine, so there's something I'm not seeing about the cause here.
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
I can confirm this issue.
Crash when running xcode 9.3.
FirebaseApp.configure()
Went and grabbed xcode 9.2 from Apple and there the code runs just fine without any changes.
However, when setting up a new target inside 9.3 and creating a new project in Firebase, it runs fine.
Existing targets crash, while new once work fine. Same code for all targets.
Running latest Firebase SDK
Thanks for the info. Perhaps it's something related to Xcode options.
We haven't yet been able to reproduce. Is anyone able to share a reproducible example?
Got the same thing in my app:
These are crashreports from Crashlytics:
0 libswiftCore.dylib | swift_getObjectType + 60
1 | <app> | AppDelegate.swift聽line聽0@objc AppDelegate.application(UIApplication, open : URL, sourceApplication : String?, annotation : Any) -> Bool
2 | <app> | -[FIRAAppDelegateProxy application:openURL:sourceApplication:annotation:] + 4306376200
3 | UIKit | __58-[UIApplication _applicationOpenURLAction:payload:origin:]_block_invoke + 876
4 | UIKit | -[UIApplication _applicationOpenURLAction:payload:origin:] + 640
Haven't been able to reproduce. This happened on both iOS 11.3 and 11.2.6 on all kinds of devices. A common thing for them all is that the device is low on RAM. Not sure if that has anything to do with the crash.
The crash is due to: EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000
I'm seeing the same issue after building my app from Xcode 9.3. My app authenticates with Spotify and when my app's URLScheme is opened from Safari, the app crashes. It never makes it to application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool where I handle the login.
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 ()
We had the same crashes and it's related to a bug in swift 4.1 / XCode 9.3 reported here :
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.
Thanks, @EmDee! Implementing application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool works for me too. Much appreciated!
Please note for those that can鈥檛 just remove that delegate call: In @LaurentLK鈥檚 link there is a very simple workaround fix, which I鈥檝e seen in other people鈥檚 code as well, where you only have to change the annotation type from Any to Any?.
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!
Thanks everyone for the research, analysis and shares! 馃挴
Had the same bug using Xcode 9.3 when updating from Firebase 3.11.0 (I know!!) to 4.13.0. So the issue (in Swift?) persists. @LaurentLK 's fix crushed it. Thanks! 馃檹
This is not fixed.
I am still getting this error using the following versions:
pod 'Firebase/Core', '~> 4.13.0'
pod 'Firebase/AdMob', '~> 4.13.0'
Xcode: 9.3.1
the stacktrace:
0 | libswiftCore.dylib | swift_getObjectType + 60
-- | -- | --
1 | Eu Sei | MyDelegate.swift聽line聽0@objc MyDelegate.application(UIApplication, open : URL, sourceApplication : String?, annotation : Any) -> Bool
2 | Eu Sei | -[FIRAAppDelegateProxy application:openURL:sourceApplication:annotation:] + 3093356
3 | UIKit | __58-[UIApplication _applicationOpenURLAction:payload:origin:]_block_invoke + 880
4 | UIKit | -[UIApplication _applicationOpenURLAction:payload:origin:] + 596
5 | UIKit | -[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:completion:] + 5468
6 | UIKit | -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1632
7 | UIKit | __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 296
8 | UIKit | -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 432
9 | UIKit | __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 220
10 | UIKit | _performActionsWithDelayForTransitionContext + 112
11 | UIKit | -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 248
12 | UIKit | -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 368
13 | UIKit | -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 468
14 | FrontBoardServices | __80-[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:]_block_invoke.362 + 212
15 | libdispatch.dylib | _dispatch_client_callout + 16
16 | libdispatch.dylib | _dispatch_block_invoke_direct$VARIANT$mp + 224
17 | FrontBoardServices | __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 36
18 | FrontBoardServices | -[FBSSerialQueue _performNext] + 404
19 | FrontBoardServices | -[FBSSerialQueue _performNextFromRunLoopSource] + 56
20 | CoreFoundation | __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
21 | CoreFoundation | __CFRunLoopDoSources0 + 276
22 | CoreFoundation | __CFRunLoopRun + 1204
23 | CoreFoundation | CFRunLoopRunSpecific + 552
24 | GraphicsServices | GSEventRunModal + 100
25 | UIKit | UIApplicationMain + 236
26 | Eu Sei | MyDelegate.swift聽line聽18main
27 | libdyld.dylib | start + 4
@deguilardi did you take a look at @LaurentLK'x fix here?
Also, please note that Firebase is currently on version 5.0.1. If you are able to reproduce there, please let me know and I'll take a look.
@ryanwilson I need the parameters sourceApplication and annotation. The proposed solution requires not using these parameters.
I am currently using the version 4.13.0. The changelog doesn't point to any fix related to this issue.
Changelog link: https://firebase.google.com/support/release-notes/ios
@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
How can this error not be related to Firebase if it breaks on
[FIRAAppDelegateProxy application:openURL:sourceApplication:annotation:]
???
Firebase manual itself is teaching to do the "wrong" way:
https://firebase.google.com/docs/dynamic-links/ios/receive
The [FIRAAppDelegateProxy application:openURL:sourceApplication:annotation:] should only be used on iOS8 and older as stated in the documentation. @deguilardi what iOS version is this breaking at for you?
You can prevent Firebase from swizzling the methods in your AppDelegate by adding FirebaseAppDelegateProxyEnabled set to NO in your app's info.plist
@chetandobariya : Keep in mind that if you decide to turn off FirebaseAppDelegateProxy, you will lose all automatic campaign events which are important to Analytics. So please follow the instructions at FIRAnalytics+AppDelegate.h to avoid missing campaign events.
@baolocdo Thanks for the sharing information. I will have a look. but for my case, I am only using remote configuration from Firebase SDK.
Most helpful comment
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) -> BoolWe just replaced it with :
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> BoolThat fixed our crashes. Hope it helps others.