-
Notifications
You must be signed in to change notification settings - Fork 130
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 URLSession instrumentation in iOS 16 #398
Conversation
…o make it work: Only NSURLSessionTask.resume and URLSessionTaskDelegate.urlSession(_:task:didFinishCollecting:) are being called (contrary to what documentation says), try to move all the logic to these two methods Also for async/await calls without delegate set a task delegate so that the taskdelegate method is called
} | ||
#else | ||
let version = UIDevice.current.systemVersion | ||
if let versionNumber = Double(version), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would https://forums.swift.org/t/swift-concurrency-back-deployment/51908/13 be preferred to check for concurrency availability?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It only fails in iOS 16, previous versions work with async/await perfectly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow, bizarre! good spot
Make InstrumentationUtils.usesUndocumentedAsyncAwaitMethods a static variable so it is only calculated once
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #398 +/- ##
==========================================
- Coverage 62.39% 62.33% -0.07%
==========================================
Files 253 253
Lines 11770 11824 +54
==========================================
+ Hits 7344 7370 +26
- Misses 4426 4454 +28
... and 1 file with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
iOS 16 broke async/await URLSession instrumentation, add extra code to make it work:
Only NSURLSessionTask.resume and URLSessionTaskDelegate.urlSession(_:task:didFinishCollecting:) are being called (contrary to what documentation says), try to move all the logic to these two methods
Also for async/await calls without delegate set a task delegate so that the delegate method is called and we can capture it
Added many tests exercising async await network calls