Skip to content

Commit

Permalink
Fix 2nd instance of Xcode 15 runtime warning in FPRNSURLSessionInstru… (
Browse files Browse the repository at this point in the history
  • Loading branch information
paulb777 authored Oct 9, 2023
1 parent 761bed3 commit 6f9b0cc
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,13 @@ void InstrumentUploadTaskWithRequestFromDataCompletionHandler(FPRNSURLSessionIns
}
typedef NSURLSessionUploadTask *(*OriginalImp)(id, SEL, NSURLRequest *, NSData *,
FPRDataTaskCompletionHandler);
return ((OriginalImp)currentIMP)(session, selector, request, bodyData,
// 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;
return ((OriginalImp)currentIMP)(session, selector, requestWithoutHTTPBody, requestData,
wrappedCompletionHandler);
}];
}
Expand Down

0 comments on commit 6f9b0cc

Please sign in to comment.