Starting with Xcode 15/iOS 17, there is a new warning in CFNetwork if you call [NSURLSession uploadTaskWithRequest:fromData:] if the request passed in already has its body set. In this case, we set the same data as the HTTPBody property of the request that we pass in to that method, so in the end the call worked fine, but now warns that we're setting it twice. Since we always set the post body on the request when we call [MPURLRequestBuilder build] on line 246, I've switched to using the more correct [NSURLSession dataTaskWithRequest] which just uses the HTTPBody from the request instead of the data we pass in. This works exactly the same, but fixes the warning.
Testing Plan
E2E tested using a test app
Reference Issue (For mParticle employees only. Ignore if you are an outside contributor)
Summary
Starting with Xcode 15/iOS 17, there is a new warning in CFNetwork if you call
[NSURLSession uploadTaskWithRequest:fromData:]
if the request passed in already has its body set. In this case, we set the same data as theHTTPBody
property of the request that we pass in to that method, so in the end the call worked fine, but now warns that we're setting it twice. Since we always set the post body on the request when we call[MPURLRequestBuilder build]
on line 246, I've switched to using the more correct[NSURLSession dataTaskWithRequest]
which just uses the HTTPBody from the request instead of the data we pass in. This works exactly the same, but fixes the warning.Testing Plan
Reference Issue (For mParticle employees only. Ignore if you are an outside contributor)