TrustKit: App crash when using Firebase Auth and TrustKit together
I am using Firebase Auth for phone sign-in and TrustKit for SSL pinning on iOS. Currently, the app will crash if I use together. Any suggestions?
— Podfile — pod ‘Firebase/Auth’, ‘~> 6.2.0’ pod ‘Firebase/Core’, ‘~> 6.2.0’ pod ‘Firebase/Messaging’, ‘~> 6.2.0’ pod ‘TrustKit’, ‘~> 1.6.2’
— Podfile.lock —
- Fabric (1.10.2)
- Firebase/Auth (6.2.0):
- Firebase/CoreOnly
- FirebaseAuth (~> 6.1.1)
- Firebase/Core (6.2.0):
- Firebase/CoreOnly
- FirebaseAnalytics (= 6.0.1)
- Firebase/CoreOnly (6.2.0):
- FirebaseCore (= 6.0.2)
- Firebase/Messaging (6.2.0):
- Firebase/CoreOnly
- FirebaseMessaging (~> 4.0.2)
- FirebaseAnalytics (6.0.1):
- FirebaseCore (~> 6.0)
- FirebaseInstanceID (~> 4.1)
- GoogleAppMeasurement (= 6.0.1)
- GoogleUtilities/AppDelegateSwizzler (~> 6.0)
- GoogleUtilities/MethodSwizzler (~> 6.0)
- GoogleUtilities/Network (~> 6.0)
- “GoogleUtilities/NSData+zlib (~> 6.0)”
- nanopb (~> 0.3)
- FirebaseAnalyticsInterop (1.4.0)
- FirebaseAuth (6.1.2):
- FirebaseAuthInterop (~> 1.0)
- FirebaseCore (~> 6.0)
- GoogleUtilities/AppDelegateSwizzler (~> 6.2)
- GoogleUtilities/Environment (~> 6.2)
- GTMSessionFetcher/Core (~> 1.1)
- FirebaseAuthInterop (1.0.0)
- FirebaseCore (6.0.2):
- GoogleUtilities/Environment (~> 6.0)
- GoogleUtilities/Logger (~> 6.0)
- FirebaseInstanceID (4.2.3):
- FirebaseCore (~> 6.0)
- GoogleUtilities/Environment (~> 6.0)
- GoogleUtilities/UserDefaults (~> 6.0)
- FirebaseMessaging (4.0.2):
- FirebaseAnalyticsInterop (~> 1.1)
- FirebaseCore (~> 6.0)
- FirebaseInstanceID (~> 4.1)
- GoogleUtilities/AppDelegateSwizzler (~> 6.2)
- GoogleUtilities/Environment (~> 6.2)
- GoogleUtilities/Reachability (~> 6.2)
- GoogleUtilities/UserDefaults (~> 6.2)
- Protobuf (~> 3.1)
— Error Logs — 2019-08-27 10:12:59.773214+0800 PAB[19389:4469184] === TrustKit: Proxy-ing NSURLSessionDelegate: GTMSessionFetcher 2019-08-27 10:12:59.773320+0800 PAB[19389:4469184] Fetcher delegate class: TSKNSURLSessionDelegateProxy 2019-08-27 10:12:59.773424+0800 PAB[19389:4469184] Fetcher made an extra session: GTMSessionFetcher 0x104c68b20 (https://www.googleapis.com/identitytoolkit/v3/relyingparty/sendVerificationCode?key=AIzaSyDOYUzUrIfsdJG92KwrPNTYdJWp6MrVF-U) 2019-08-27 10:12:59.773456+0800 PAB[19389:4469184] Couldn’t assign delegate. 2019-08-27 10:12:59.773764+0800 PAB[19389:4469184] Fetcher delegate class: TSKNSURLSessionDelegateProxy 2019-08-27 10:12:59.773823+0800 PAB[19389:4469184] -[GTMSessionFetcher setFetcher:forTask:]: unrecognized selector sent to instance 0x104c68b20 2019-08-27 10:12:59.773998+0800 PAB[19389:4469184] *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[GTMSessionFetcher setFetcher:forTask:]: unrecognized selector sent to instance 0x104c68b20’ *** First throw call stack: (0x193e5a98c 0x1930339f8 0x193d771c8 0x193e601d4 0x193e61e6c 0x1023ac4d4 0x10238a20c 0x102386a48 0x102277b20 0x10227a7e8 0x1022797bc 0x102277284 0x10229b428 0x10229b960 0x10229af74 0x10229ab88 0x102285650 0x1022852dc 0x10226e520 0x104868c78 0x104877480 0x10226e444 0x10226dfec 0x193e62010 0x193d43be0 0x1023e06b4 0x1023de918 0x193d463c8 0x1023de720 0x1023e0500 0x102284ff0 0x1048676f4 0x104868c78 0x1048766fc 0x193dec32c 0x193de7264 0x193de67c0 0x195fe779c 0x1c08e5c38 0x102246418 0x1938aa8e0) libc++abi.dylib: terminating with uncaught exception of type NSException
— Stacktrace —
- thread #1, queue = ‘com.google.firebase.auth.globalWorkQueue’, stop reason = signal SIGABRT
frame #0: 0x00000001939f70dc libsystem_kernel.dylib
__pthread_kill + 8 frame #1: 0x0000000193a749b0 libsystem_pthread.dylibpthread_kill$VARIANT$armv81 + 296 frame #2: 0x000000019394fea8 libsystem_c.dylibabort + 140 frame #3: 0x000000019301c788 libc++abi.dylibabort_message + 132 frame #4: 0x000000019301c934 libc++abi.dylibdefault_terminate_handler() + 308 frame #5: 0x0000000193033e00 libobjc.A.dylib_objc_terminate() + 124 frame #6: 0x0000000193028838 libc++abi.dylibstd::__terminate(void (*)()) + 16 frame #7: 0x00000001930288c4 libc++abi.dylibstd::terminate() + 84 frame #8: 0x0000000193033d5c libobjc.A.dylibobjc_terminate + 12 frame #9: 0x000000010627cc8c libdispatch.dylib_dispatch_client_callout + 36 frame #10: 0x000000010628b480 libdispatch.dylib`_dispatch_lane_barrier_sync_invoke_and_complete + 124- frame #11: 0x00000001041d2278 PAB
-[FIRAuth setAPNSToken:type:](self=0x0000000283a1d680, _cmd="setAPNSToken:type:", token=32 bytes, type=FIRAuthAPNSTokenTypeUnknown) at FIRAuth.m:1371:3 frame #12: 0x00000001041d1d50 PAB-[FIRAuth application:didRegisterForRemoteNotificationsWithDeviceToken:](self=0x0000000283a1d680, _cmd=“application:didRegisterForRemoteNotificationsWithDeviceToken:”, application=0x0000000106b07f90, deviceToken=32 bytes) at FIRAuth.m:1336:3 frame #13: 0x0000000193e62010 CoreFoundation__invoking___ + 144 frame #14: 0x0000000193d43be0 CoreFoundation-[NSInvocation invoke] + 292 frame #15: 0x0000000104343cbc PAB__93-[GULAppDelegateSwizzler application:donor_didRegisterForRemoteNotificationsWithDeviceToken:]_block_invoke(.block_descriptor=0x000000016bc5a780, interceptor=0x0000000283a1d680) at GULAppDelegateSwizzler.m:849:37 frame #16: 0x0000000104342918 PAB__72+[GULAppDelegateSwizzler notifyInterceptorsWithMethodSelector:callback:]_block_invoke(.block_descriptor=0x000000016bc5a6e0, key=@“GUL_0x283a1d680”, obj=0x0000000280910e00, stop=NO) at GULAppDelegateSwizzler.m:680:7 frame #17: 0x0000000193d463c8 CoreFoundation-[__NSFrozenDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:] + 176 frame #18: 0x0000000104342720 PAB+[GULAppDelegateSwizzler notifyInterceptorsWithMethodSelector:callback:](self=GULAppDelegateSwizzler, _cmd=“notifyInterceptorsWithMethodSelector:callback:”, methodSelector=“application:didRegisterForRemoteNotificationsWithDeviceToken:”, callback=0x0000000104343b9c) at GULAppDelegateSwizzler.m:667:3 frame #19: 0x0000000104343b08 PAB-[GULAppDelegateSwizzler application:donor_didRegisterForRemoteNotificationsWithDeviceToken:](self=0x0000000280b006c0, _cmd="application:didRegisterForRemoteNotificationsWithDeviceToken:", application=0x0000000106b07f90, deviceToken=32 bytes) at GULAppDelegateSwizzler.m:840:3 frame #20: 0x000000010627b6f4 libdispatch.dylib_dispatch_call_block_and_release + 24 frame #21: 0x000000010627cc78 libdispatch.dylib_dispatch_client_callout + 16 frame #22: 0x000000010628a6fc libdispatch.dylib_dispatch_main_queue_callback_4CF + 1360 frame #23: 0x0000000193dec32c CoreFoundation__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 frame #24: 0x0000000193de7264 CoreFoundation__CFRunLoopRun + 1924 frame #25: 0x0000000193de67c0 CoreFoundationCFRunLoopRunSpecific + 436 frame #26: 0x0000000195fe779c GraphicsServicesGSEventRunModal + 104 frame #27: 0x00000001c08e5c38 UIKitCoreUIApplicationMain + 212 frame #28: 0x00000001041aa418 PABmain(argc=2, argv=0x000000016bc5b7d8) at main.m:14:13 frame #29: 0x00000001938aa8e0 libdyld.dylib`start + 4
- frame #11: 0x00000001041d2278 PAB
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (1 by maintainers)
@barak109 For me, i turned off the TrustKit swizzling and use the custom url session. You can follow the one in their README
@thetminko Thank you very much! and yes i use ‘react-native-cert-pinner’. And i have a good tip for you to use npm package for patches and it will save it for you even after you remove the node_modules. So i guess we help each other 😃
@barak109 Are u using react-native-cert-pinner? if so, u go to node_modules/react-native-cert-pinner/cli/cmds/gen.js and find TSKSwizzleNetworkDelegates and change the value to false and force checkout in git. Thats what i did and as long as didn’t remove the node_modules and install again, should be fine
@barak109 @thetminko We ended up swizzling
GTMSessionFetcherServicethat was causing the crash (not just with TrustKit but also with other libraries). See https://github.com/google/gtm-session-fetcher/issues/190.Thanks @thetminko and that’s correct - disabling TrustKit swizzling should resolve this issue.