From 1110931f77c313a97862e6faa8c1809d1a469caf Mon Sep 17 00:00:00 2001 From: Rafal Augustyniak Date: Wed, 11 Sep 2024 17:29:26 -0400 Subject: [PATCH 1/2] fix crash with google maps --- .../url_session/extensions/URLSession+Swizzling.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/platform/swift/source/integrations/url_session/extensions/URLSession+Swizzling.swift b/platform/swift/source/integrations/url_session/extensions/URLSession+Swizzling.swift index bedc1b78..aba93a37 100644 --- a/platform/swift/source/integrations/url_session/extensions/URLSession+Swizzling.swift +++ b/platform/swift/source/integrations/url_session/extensions/URLSession+Swizzling.swift @@ -33,7 +33,7 @@ extension URLSession { // `URLSession.init(configuration:delegate:delegateQueue)` so the call below calls the original // initializer. - if delegate != nil { + if let delegate { // Proxying delegates of some 3rd party frameworks leads to crashes. Disable proxying for // problematic classes. // Refer to the following GitHub comments for more details: @@ -41,12 +41,13 @@ extension URLSession { // * https://github.com/google/gtm-session-fetcher/issues/190#issuecomment-604757154 let disabledDelegateClassNames = [ "GMPx_GTMSessionFetcherSessionDelegateDispatcher", // GooglePlaces SDK - "GTMSessionFetcherSessionDelegateDispatcher", // GoogleMaps/GTMSessionFetcher SDK + "GMSx_GTMSessionFetcherSessionDelegateDispatcher", // GoogleMaps SDK + "GTMSessionFetcherSessionDelegateDispatcher", // GTMSessionFetcher SDK ] let shouldDisableProxying = disabledDelegateClassNames .compactMap { NSClassFromString($0) } - .contains { delegate?.isKind(of: $0) == true } + .contains { delegate.isKind(of: $0) == true } if shouldDisableProxying { return Self.cap_makeSession( From d083cfaeb8d5845c572246c8355d4c77d42af7ec Mon Sep 17 00:00:00 2001 From: Rafal Augustyniak Date: Wed, 11 Sep 2024 17:30:50 -0400 Subject: [PATCH 2/2] remove == --- .../url_session/extensions/URLSession+Swizzling.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/swift/source/integrations/url_session/extensions/URLSession+Swizzling.swift b/platform/swift/source/integrations/url_session/extensions/URLSession+Swizzling.swift index aba93a37..3efeed90 100644 --- a/platform/swift/source/integrations/url_session/extensions/URLSession+Swizzling.swift +++ b/platform/swift/source/integrations/url_session/extensions/URLSession+Swizzling.swift @@ -47,7 +47,7 @@ extension URLSession { let shouldDisableProxying = disabledDelegateClassNames .compactMap { NSClassFromString($0) } - .contains { delegate.isKind(of: $0) == true } + .contains { delegate.isKind(of: $0) } if shouldDisableProxying { return Self.cap_makeSession(