firebase / firebase-ios-sdk

Firebase SDK for Apple App Development
https://firebase.google.com
Apache License 2.0
5.66k stars 1.48k forks source link

Runtime warning in FPRNSURLSessionInstrument when running on iOS 17 RC built with Xcode 15 RC #11821

Closed TAATHub closed 1 year ago

TAATHub commented 1 year ago

Description

Similar to https://github.com/firebase/firebase-ios-sdk/issues/11536, a runtime warning as below occurs when running on iOS 17 RC built with Xcode 15 RC.

Warning:

The request of a upload task should not contain a body or a body stream, use `upload(for:fromFile:)`, `upload(for:from:)`, or supply the body stream through the `urlSession(_:needNewBodyStreamForTask:)` delegate method.

Code:

/** Instruments -uploadTaskWithRequest:fromData:.
 *
 *  @param instrument The FPRNSURLSessionInstrument instance.
 *  @param instrumentor The FPRClassInstrumentor to add the selector instrumentor to.
 */
FOUNDATION_STATIC_INLINE
NS_EXTENSION_UNAVAILABLE("Firebase Performance is not supported for extensions.")
void InstrumentUploadTaskWithRequestFromData(FPRNSURLSessionInstrument *instrument,
                                             FPRClassInstrumentor *instrumentor) {
    ...
    NSURLSessionUploadTask *uploadTask =
        ((OriginalImp)currentIMP)(session, selector, request, bodyData); // This line causes the warning
    if (uploadTask.originalRequest) {
      FPRNetworkTrace *trace =
          [[FPRNetworkTrace alloc] initWithURLRequest:uploadTask.originalRequest];
      [trace start];
      trace.requestSize = bodyData.length;
      [trace checkpointState:FPRNetworkTraceCheckpointStateInitiated];
      [FPRNetworkTrace addNetworkTrace:trace toObject:uploadTask];
    }
    return uploadTask;
  }];
}

Reproducing the issue

Run an app and check the runtime warnings on Xcode.

Firebase SDK Version

10.9.0 (also occurred with 10.15.0)

Xcode Version

15.0 (15A240d)

Installation Method

Swift Package Manager

Firebase Product(s)

Analytics, App Distribution, Authentication, Crashlytics, DynamicLinks, Performance

Targeted Platforms

iOS

Relevant Log Output

The request of a upload task should not contain a body or a body stream, use `upload(for:fromFile:)`, `upload(for:from:)`, or supply the body stream through the `urlSession(_:needNewBodyStreamForTask:)` delegate method.

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet
```json Replace this line with the contents of your Package.resolved. ```

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet
```yml Replace this line with the contents of your Podfile.lock! ```
google-oss-bot commented 1 year ago

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

TAATHub commented 1 year ago

runtime_warning

UjjwalNepal commented 1 year ago

Yeah same on ios 17.0

skywalkerlw commented 1 year ago

I can see exactly the same warning here. App crash rating increases, not sure related to it or not.

image
paulb777 commented 1 year ago

@skywalkerlw The fix is staged for our next 10.16.0 release planned for next week.

garethlloyd1994 commented 1 year ago

We are still seeing this warning in 10.16.0 - did the fix get released with this change?

Screenshot 2023-10-06 at 4 30 36 pm Screenshot 2023-10-06 at 4 30 27 pm

paulb777 commented 1 year ago

The fix got deployed in the InstrumentUploadTaskWithRequestFromData function, but it looks like the same issue is still in InstrumentUploadTaskWithStreamedRequest.

thanks for the report. We'll put this on this list for the next release.