Firebase Performance Monitoring如何在iOS中拦截传出的HTTP请求? [英] How Firebase Performance Monitoring intercepts outgoing http requests in iOS?
问题描述
从firebase的帮助文档中可以看到,
From firebase's help doc, it states
对于所有应用类型,性能监控会自动收集跟踪由您的应用发出的每个网络请求(称为HTTP/S)网络请求跟踪性能监控自动收集使用以下网络的网络请求的指标库:URLSession,URLConnection
For all app types, Performance Monitoring automatically collects a trace for each network request issued by your app, called an HTTP/S network request trace Performance Monitoring automatically collects metrics for network requests that use the following networking libraries: URLSession, URLConnection
他们如何自动跟踪http请求?
How are they tracking the http requests automatically ?
推荐答案
在iOS上,Firebase Performance Monitoring使用方法令人毛骨悚然有效地将对 NSURLConnection
的调用重写为自己的实现(依次调用回原始的iOS实现).这样,SDK可以记录应用程序对HTTP请求的操作.
On iOS, Firebase Performance Monitoring uses method swizzling to effectively rewrite calls to NSURLConnection
to its own implementation (which in turn calls back into the original iOS implementation). This allows the SDK to record what the app is doing for HTTP requests.
这篇关于Firebase Performance Monitoring如何在iOS中拦截传出的HTTP请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!