Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Xcode 15 runtime warning #11825

Merged
merged 2 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions FirebasePerformance/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 10.16.0
- [fixed] Fix Xcode 15 runtime warning (#11821).

# 10.12.0
- [fixed] Make Firebase performance compatible with Xcode15.
- [changed] Removed the capability to access Carrier information of the device since that API is deprecated by Apple.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,14 @@ void InstrumentUploadTaskWithRequestFromData(FPRNSURLSessionInstrument *instrume
ThrowExceptionBecauseInstrumentHasBeenDeallocated(selector, instrumentor.instrumentedClass);
}
typedef NSURLSessionUploadTask *(*OriginalImp)(id, SEL, NSURLRequest *, NSData *);
// To avoid a runtime warning in Xcode 15, the given `URLRequest`
// should have a nil `HTTPBody`. To workaround this, the `HTTPBody` data is removed
// and requestData is replaced with it, if it bodyData was `nil`.
NSMutableURLRequest *requestWithoutHTTPBody = [request mutableCopy];
NSData *requestData = bodyData ?: requestWithoutHTTPBody.HTTPBody;
requestWithoutHTTPBody.HTTPBody = nil;
NSURLSessionUploadTask *uploadTask =
((OriginalImp)currentIMP)(session, selector, request, bodyData);
((OriginalImp)currentIMP)(session, selector, requestWithoutHTTPBody, requestData);
if (uploadTask.originalRequest) {
FPRNetworkTrace *trace =
[[FPRNetworkTrace alloc] initWithURLRequest:uploadTask.originalRequest];
Expand Down
Loading