I just updated my pods and migrated all my API's to the Firebase iOS 5.0 API and Google Sign In no longer works. Following the Firebase iOS guide setting the GIDSignIn client ID
GIDSignIn.sharedInstance().clientID = FirebaseApp.app()?.options.clientID
causes a crash due to an unrecognized selector.
2018-05-12 16:54:03.492809-0600 App[66365:6095576] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryI gtm_httpArgumentsString]: unrecognized selector sent to instance 0x6040002778c0'
*** First throw call stack:
(
0 CoreFoundation 0x0000000118e6b1e6 __exceptionPreprocess + 294
1 libobjc.A.dylib 0x0000000117206031 objc_exception_throw + 48
2 CoreFoundation 0x0000000118eec784 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x0000000118ded898 ___forwarding___ + 1432
4 CoreFoundation 0x0000000118ded278 _CF_forwarding_prep_0 + 120
5 App 0x000000010bb6c69e -[GIDRuntimeConfigFetcher initWithSDKVersion:clientID:bundleID:] + 250
6 App 0x000000010bb6e5a7 -[GIDSignIn fetchRuntimeConfigWithHandler:] + 142
7 App 0x000000010bb6e05e -[GIDSignIn setClientID:] + 260
8 App 0x000000010adfdc70 _T03App14SystemServicesC011setupGoogleC033_7DEEA921CB63ACD09AF6046D0108E167LLyyFZ + 944
9 App 0x000000010adfd682 _T03App14SystemServicesC6createACyFZ + 98
10 App 0x000000010b2cfb00 _T03App06ClientA8DelegateC11applicationSbSo13UIApplicationC_s10DictionaryVySC0E16LaunchOptionsKeyVypGSg022didFinishLaunchingWithH0tF + 64
11 App 0x000000010b2d026a _T03App06ClientA8DelegateC11applicationSbSo13UIApplicationC_s10DictionaryVySC0E16LaunchOptionsKeyVypGSg022didFinishLaunchingWithH0tFTo + 186
12 UIKit 0x000000011410e75b -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 278
13 UIKit 0x00000001141101d2 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4123
14 UIKit 0x000000011411562b -[UIApplication _runWithMainScene:transitionContext:completion:] + 1677
15 UIKit 0x00000001144d7e4a __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 866
16 UIKit 0x00000001148aa909 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
17 UIKit 0x00000001144d7a86 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236
18 UIKit 0x00000001144d82a7 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 675
19 UIKit 0x0000000114e494d4 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 299
20 UIKit 0x0000000114e4936e -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433
21 UIKit 0x0000000114b2d62d __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 221
22 UIKit 0x0000000114d28387 _performActionsWithDelayForTransitionContext + 100
23 UIKit 0x0000000114b2d4f7 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223
24 UIKit 0x00000001148a9fb0 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
25 UIKit 0x0000000114113f0c -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 515
26 UIKit 0x00000001146e6a97 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
27 FrontBoardServices 0x000000011bf192f3 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 331
28 FrontBoardServices 0x000000011bf21cfa __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 225
29 libdispatch.dylib 0x000000011b0ad848 _dispatch_client_callout + 8
30 libdispatch.dylib 0x000000011b0b2e14 _dispatch_block_invoke_direct + 592
31 FrontBoardServices 0x000000011bf4d470 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
32 FrontBoardServices 0x000000011bf4d12e -[FBSSerialQueue _performNext] + 439
33 FrontBoardServices 0x000000011bf4d68e -[FBSSerialQueue _performNextFromRunLoopSource] + 45
34 CoreFoundation 0x0000000118e0dbb1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
35 CoreFoundation 0x0000000118df24af __CFRunLoopDoSources0 + 271
36 CoreFoundation 0x0000000118df1a6f __CFRunLoopRun + 1263
37 CoreFoundation 0x0000000118df130b CFRunLoopRunSpecific + 635
38 GraphicsServices 0x000000011c393a73 GSEventRunModal + 62
39 UIKit 0x00000001141170b7 UIApplicationMain + 159
40 App 0x000000010ada6eb7 main + 55
41 libdyld.dylib 0x000000011b12a955 start + 1
42 ??? 0x0000000000000001 0x0 + 1
Here is a list of my Firebase/Google pod versions:
- Firebase/Analytics (5.0.0):
- Firebase/Core
- Firebase/Auth (5.0.0):
- Firebase/CoreOnly
- FirebaseAuth (= 5.0.0)
- Firebase/Core (5.0.0):
- Firebase/CoreOnly
- FirebaseAnalytics (= 5.0.0)
- Firebase/CoreOnly (5.0.0):
- FirebaseCore (= 5.0.0)
- Firebase/Database (5.0.0):
- Firebase/CoreOnly
- FirebaseDatabase (= 5.0.0)
- Firebase/DynamicLinks (5.0.0):
- Firebase/Core
- FirebaseDynamicLinks (= 3.0.0)
- Firebase/Functions (5.0.0):
- Firebase/CoreOnly
- FirebaseFunctions (= 2.0.0)
- Firebase/Messaging (5.0.0):
- Firebase/CoreOnly
- FirebaseMessaging (= 3.0.0)
- Firebase/RemoteConfig (5.0.0):
- Firebase/Core
- FirebaseRemoteConfig (= 3.0.0)
- Firebase/Storage (5.0.0):
- Firebase/CoreOnly
- FirebaseStorage (= 3.0.0)
- FirebaseABTesting (2.0.0):
- FirebaseCore (~> 5.0)
- Protobuf (~> 3.5)
- FirebaseAnalytics (5.0.0):
- FirebaseCore (~> 5.0)
- FirebaseInstanceID (~> 3.0)
- "GoogleToolboxForMac/NSData+zlib (~> 2.1)"
- nanopb (~> 0.3)
- FirebaseAuth (5.0.0):
- FirebaseCore (~> 5.0)
- GTMSessionFetcher/Core (~> 1.1)
- FirebaseCore (5.0.0):
- "GoogleToolboxForMac/NSData+zlib (~> 2.1)"
- FirebaseDatabase (5.0.0):
- FirebaseCore (~> 5.0)
- leveldb-library (~> 1.18)
- FirebaseDynamicLinks (3.0.0):
- FirebaseAnalytics (~> 5.0)
- FirebaseFunctions (2.0.0):
- FirebaseCore (~> 5.0)
- GTMSessionFetcher/Core (~> 1.1)
- FirebaseInstanceID (3.0.0):
- FirebaseCore (~> 5.0)
- FirebaseMessaging (3.0.0):
- FirebaseCore (~> 5.0)
- FirebaseInstanceID (~> 3.0)
- GoogleToolboxForMac/Logger (~> 2.1)
- Protobuf (~> 3.1)
- FirebaseRemoteConfig (3.0.0):
- FirebaseABTesting (~> 2.0)
- FirebaseAnalytics (~> 5.0)
- FirebaseCore (~> 5.0)
- FirebaseInstanceID (~> 3.0)
- "GoogleToolboxForMac/NSData+zlib (~> 2.1)"
- Protobuf (~> 3.5)
- FirebaseStorage (3.0.0):
- FirebaseCore (~> 5.0)
- GTMSessionFetcher/Core (~> 1.1)
- GoogleSignIn (4.1.2):
- "GoogleToolboxForMac/NSDictionary+URLArguments (~> 2.1)"
- "GoogleToolboxForMac/NSString+URLArguments (~> 2.1)"
- GTMOAuth2 (~> 1.0)
- GTMSessionFetcher/Core (~> 1.1)
- GoogleToolboxForMac/Core (2.1.4):
- GoogleToolboxForMac/Defines (= 2.1.4)
- GoogleToolboxForMac/DebugUtils (2.1.4):
- GoogleToolboxForMac/Defines (= 2.1.4)
- GoogleToolboxForMac/Defines (2.1.4)
- GoogleToolboxForMac/Logger (2.1.4):
- GoogleToolboxForMac/Defines (= 2.1.4)
- "GoogleToolboxForMac/NSData+zlib (2.1.4)":
- GoogleToolboxForMac/Defines (= 2.1.4)
- "GoogleToolboxForMac/NSDictionary+URLArguments (2.1.4)":
- GoogleToolboxForMac/DebugUtils (= 2.1.4)
- GoogleToolboxForMac/Defines (= 2.1.4)
- "GoogleToolboxForMac/NSString+URLArguments (= 2.1.4)"
- "GoogleToolboxForMac/NSString+URLArguments (2.1.4)"
- GTMOAuth2 (1.1.6):
- GTMSessionFetcher (~> 1.1)
- GTMSessionFetcher (1.1.15):
- GTMSessionFetcher/Full (= 1.1.15)
- GTMSessionFetcher/Core (1.1.15)
- GTMSessionFetcher/Full (1.1.15):
- GTMSessionFetcher/Core (= 1.1.15)
You may have a bad Xcode state and need to rm -rf ~/Library/Developer/Xcode/DerivedData.
The selector gtm_httpArgumentsString is defined in GoogleToolboxForMac/NSDictionary+URLArguments and that pod subspec shows up in your list of installed pods.
I previously (and again after your comment) tried removing derived data, removing all Pods, cleaning from Xcode. The issue still persists :(
Xcode lists this warning re: categories, which may be why it is unable to find the correct method:
ld: warning: Some object files have incompatible Objective-C category definitions.
Some category metadata may be lost. All files containing Objective-C categories
should be built using the same compiler.
Yep, that warning is likely related - since it's an NSDictionary category that seems not to be linked.
Is the -ObjC option in the OTHER_LDFLAGS Build Setting? Is there any more information to indicate where the incompatible category definition is?
Web searching on the warning may provide other clues.
This code crashed on test.gtm_httpArgumentsString(), but it compiles fine:
let test = ["BOB":"FRED"] as NSDictionary
let string = test.gtm_httpArgumentsString()
print(string!)
-ObjC was already in my LDFlags. I had a reduced build target that didn't run into the crashing issue so I duplicated it and added back my extensions and watch app. Compared all the build settings between the crashing and non-crashing targets and made them identical. Still crashed in one, not the other. I am still getting the warning but its not crashing anymore with my newly created target. Closing the issue since I found a work around.
Unfortunately, it was only working temporarily, it is broken again with the same crash as above.
@jlaws Do any of the answers at https://stackoverflow.com/questions/39665979/xcode-8-objective-c-category-warning apply to your app?
Turns out the pod card.io was causing the linker issues so we removed it from our dependencies. Completely removed derived data, cleaned, and built. The project no longer has any warnings but still crashes when attempting to set the clientID
@jlaws Is it still an unrecognizable selector crash? Are you able to reproduce in an example you can share?
Yes it is the same unrecognizable selector crash. Will try and get an example setup to share if we can't resolve it today.
Looks like others are running into the same issue with the GoogleSignIn library and they aren't using Firebase
Adding the deprecated Google pod fixes it for some weird reason, but adds back the linker errors. Others have been seeing the issue since 2015 so it is definitely not new. Will keep posting updates here until we find a better solution.
Interesting. It looks like some of the remarks at https://github.com/googlesamples/google-services/issues/102 are related to missing -ObjC which would definitely cause the category not to be linked. I'm not sure why linking in the deprecated pod would make any difference on finding other symbols.
Does adding -all_load to OTHER_LDFLAGS make any difference?
We developed a workaround by adding the deprecated cocoapod 'Google' to our dependencies. This magically enabled the linker to find the symbols we need. Definitely not the long term solution.
During this process I added the Firebase/Performance pod back to our dependencies (with and without 'Google'), but that completely broke the linker at app startup due to missing GTMLogger symbols.
Whats interesting about this is that our reduced app has no problem compiling/running, but when we compile it with the exact same build settings and our 6 extensions and watch app, the linker completely fails.
Will try and get a demo app up and running that can repro the error so we can share it.
-all_load doesn't help, and I also have no idea why adding the Google pod makes a difference. My theory is that it contains more categories that cause the linker to behave in a new way that avoids whatever the underlying bug/issue is.
It would be great if GoogleSignIn was open source so we could just manually remove the category usage to avoid the crash. That being said, are there any plans to open source the GoogleSignIn pod that is required for Google authentication in Firebase?
@jlaws Sorry I can't say anything about GoogleSignIn plans.
In the crashing situation, does GTMNSDictionary+URLArguments.m show up in the Xcode build log?
Are you able to make a shareable example that demonstrates the crash?
@paulb777 apologies, I haven't had time to create a test example yet, but will look into it again next week.
I am also having the same problem. I have an iOS app with a messages extension. When I run the app it crashes when I execute
GIDSignIn.sharedInstance().clientID = FirebaseApp.app()?.options.clientID
with error message
-[__NSDictionaryI gtm_httpArgumentsString]: unrecognized selector sent to instance 0x600000463d80
(null)
I have created a test app with a single view controller that does nothing and a messages extension that does nothing except show Hello World. Still get the crash. When I use the Firebase Authentication sample code to try to reproduce it, I don't get the crash, even when I add in a messages extension.
Comparing the pods in the Firebase sample and my test app, all versions are the same. Changed my code to execute the same sequence of startup code that the sample app does, to no avail.
There is something going on at a lower level that I just can't figure out. I have attached my testapp source if anyone is inclined to take a look.
Thank you.
testapp.zip
We also only see the issue when compiling our extensions (messaging and sharing) in with our main app.
@fgrios Thanks for the testapp! I was able to reproduce and diagnose a CocoaPods subspec bug. CocoaPods is trying to install both GoogleToolboxForMac subspec combinations instead of the only the correct one.
A workaround is to delete the extra framework from the Embed Pods Framework Build Phase and two lines in the Pods-testapp-frameworks.sh script:


I'll follow up with a CocoaPods bug report.
Thanks Paul, that fixed the issue for me, hopefully we can get a long term fix from the Cocoapods team that doesn't require changing the pods code every update
It turns out the bug has already been fixed on CocoaPods master, so the fix will be in the upcoming CocoaPods 1.6.0 beta.
I'll close this issue now with the resolution being the workaround for the near term and CocoaPods 1.6.0+ as the long term solution.
Thanks for the report @jlaws and @fgrios!
Thank you for the help. It seems to have taken care of another related problem as well!
Thank you for the help. It seems to have taken care of another related problem as well!
I don't think this is fixed in the Cocoapods 1.6.0 beta - I'm still getting an identical crash, and the workaround still seems to be necessary:
Using version 1.5.3, I get the following in the frameworks.sh script, and the extra framework in the Embed Pods Framework build phase:

Updating to 1.6.0.beta, I get the following in the frameworks.sh script + the same as before in the Embed Pods Framework build phase:

Thanks @siburb
It looks like this regressed on CocoaPods master before the beta was published. I verified that a mid-July version of master was correct, but it is now broken again. I'll reopen https://github.com/CocoaPods/CocoaPods/issues/7850 and investigate there.
The fix for the CocoaPods bug is now pushed to master, so 1.6.0.beta.2 should work correctly.
Most helpful comment
Thank you for the help. It seems to have taken care of another related problem as well!