From c00351dfd7e59a397fccfb56dfdecff8fab7e2f8 Mon Sep 17 00:00:00 2001 From: Nick Dowell Date: Fri, 25 Mar 2022 11:29:39 +0000 Subject: [PATCH] Fix crash when using BugsnagNetworkRequestPlugin alongside New Relic --- .../BSGURLSessionTracingProxy.m | 15 ++------------- CHANGELOG.md | 7 +++++++ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/BugsnagNetworkRequestPlugin/BugsnagNetworkRequestPlugin/BSGURLSessionTracingProxy.m b/BugsnagNetworkRequestPlugin/BugsnagNetworkRequestPlugin/BSGURLSessionTracingProxy.m index d01e8a366..d34b8562d 100644 --- a/BugsnagNetworkRequestPlugin/BugsnagNetworkRequestPlugin/BSGURLSessionTracingProxy.m +++ b/BugsnagNetworkRequestPlugin/BugsnagNetworkRequestPlugin/BSGURLSessionTracingProxy.m @@ -36,19 +36,8 @@ - (BOOL)respondsToSelector:(SEL)aSelector { return [self.delegate respondsToSelector:aSelector]; } -- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector { - // Note: We allow a race condition on self.tracingDelegate.canTrace because the - // caller has already determined that we respond to selector, and it would - // break things to stop "supporting" it now. We'll catch this edge case in - // forwardInvocation, and again in the call to tracingDelegate. - if (sel_isEqual(aSelector, METRICS_SELECTOR)) { - return [(NSObject *)self.tracingDelegate methodSignatureForSelector:aSelector]; - } - return [(NSObject *)self.delegate methodSignatureForSelector:aSelector]; -} - -- (void)forwardInvocation:(NSInvocation *)invocation { - [invocation invokeWithTarget:self.delegate]; +- (id)forwardingTargetForSelector:(__unused SEL)aSelector { + return self.delegate; } - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didFinishCollectingMetrics:(NSURLSessionTaskMetrics *)metrics diff --git a/CHANGELOG.md b/CHANGELOG.md index 37b4081b9..06fa46e78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ Changelog ========= +## TBD + +### Bug fixes + +* Fix `-[NSProxy doesNotRecognizeSelector:]` crash when using `BugsnagNetworkRequestPlugin` in projects that use the New Relic SDK. + [#1324](https://github.com/bugsnag/bugsnag-cocoa/pull/1324) + ## 6.16.4 (2022-03-02) ### Bug fixes