HTTP Traffic not recording data on iphone

When I attempt to log network requests with the new "Network" profiling template with "Http Traffic" instrument (Instruments version 13.2.1), I get network connections data on my iphone, but no HTTP traffic data. I'm running with iOS 15.3 on iphone 11, and running macos 12.2

I get the warning that sensitive data will be recorded in the trace, but I never get any actual events posted there. I also don't get any kind of warnings or errors from Instruments telling me why it might have issues recording anything. I get these data from Charles just fine (when I properly setup Charles as a proxy).

From what I read, Instruments HTTP Traffic should "just work", but for me it's not and not telling me why. Is there any way to diagnose why I'm not getting any Http traffic data in my recordings? I've disabled web protection on the phone (Microsoft Defender), which was necessary for Charles to work, but I never needed to install any certificate for instruments (or are there any instructions to do so), so I assume there is a default certificate that is used to encrypt web traffic which instruments can decrypt. I'd really like to use this tool!

Answered by Developer Tools Engineer in 703658022

Hi kirkle,

I suspect you are hitting one of the privacy limitations of the HTTP traffic instrument: The HTTP traffic instrument can only record traffic from processes that are signed with a developer profile. So you won't be able to observe traffic of an AppStore build of your app, but if you install the app via Xcode to your device, Instruments should be able to capture it. If you are using background sessions it should also be able to show you the traffic of your app that's handle by urlsessiond (the daemon handling background session on behalf of apps), but again only traffic originating from developer-signed apps, not any other traffic going through urlsessiond. You are currently not able to see traffic of other processes doing networking work on behalf of your app (e.g. WebKit views or video streaming handled by AVFoundation).

If you are already targeting an app built and installed via Xcode and still don't see any traffic, please file a bug via https://feedbackassistant.apple.com. If you can reproduce the bug with an example project (e.g. just make a new simple iOS app and let it send a request to apple.com and profile it with the HTTP Traffic instrument), attaching that would be very helpful!

If it turns out that the issue was indeed that you were targeting a non-development signed application, it might still make sense to file bugs for the following issue:

  • Better error reporting for this case: Please describe what you were trying to do and why you expected it to work, so we can find a way to report an error in the appropriate place.
  • Request for targeting non-development signed processes: We are aware that it would be useful to target other processes as well, but the current limitation is in place to prevent the tool from being abused to capture other people's network traffic. To help us make a good trade-off between making this as useful as it can be and user privacy, it would be very helpful if you could describe your case in more detail in the bug/enhancement request. Please mention things like whether this is on a device used for development, whether it's an AppStore/Enterprise/Testfight build, whether it's an app you are working on or whether you are trying to observe traffic of apps of other developers, what kind of traffic you are observing (traffic originating from your app, background traffic, CloudKit/WebKit/AVFoundation), etc.

Thanks a lot for helping us make our tools better!

Accepted Answer

Hi kirkle,

I suspect you are hitting one of the privacy limitations of the HTTP traffic instrument: The HTTP traffic instrument can only record traffic from processes that are signed with a developer profile. So you won't be able to observe traffic of an AppStore build of your app, but if you install the app via Xcode to your device, Instruments should be able to capture it. If you are using background sessions it should also be able to show you the traffic of your app that's handle by urlsessiond (the daemon handling background session on behalf of apps), but again only traffic originating from developer-signed apps, not any other traffic going through urlsessiond. You are currently not able to see traffic of other processes doing networking work on behalf of your app (e.g. WebKit views or video streaming handled by AVFoundation).

If you are already targeting an app built and installed via Xcode and still don't see any traffic, please file a bug via https://feedbackassistant.apple.com. If you can reproduce the bug with an example project (e.g. just make a new simple iOS app and let it send a request to apple.com and profile it with the HTTP Traffic instrument), attaching that would be very helpful!

If it turns out that the issue was indeed that you were targeting a non-development signed application, it might still make sense to file bugs for the following issue:

  • Better error reporting for this case: Please describe what you were trying to do and why you expected it to work, so we can find a way to report an error in the appropriate place.
  • Request for targeting non-development signed processes: We are aware that it would be useful to target other processes as well, but the current limitation is in place to prevent the tool from being abused to capture other people's network traffic. To help us make a good trade-off between making this as useful as it can be and user privacy, it would be very helpful if you could describe your case in more detail in the bug/enhancement request. Please mention things like whether this is on a device used for development, whether it's an AppStore/Enterprise/Testfight build, whether it's an app you are working on or whether you are trying to observe traffic of apps of other developers, what kind of traffic you are observing (traffic originating from your app, background traffic, CloudKit/WebKit/AVFoundation), etc.

Thanks a lot for helping us make our tools better!

I had been tracing an app deployed via xcode - so that wasn't the problem.

"You are currently not able to see traffic of other processes doing networking work on behalf of your app (e.g. WebKit views or video streaming handled by AVFoundation)."

That must be the problem I'm having. Hooked into a portion of our app which was doing URLSession request directly and did see the traffic. Thanks for the help.

Looking forward to the day when AVFoundation traffic will be observable. This is a big limitation for using instruments to diagnose video streaming apps.

HTTP Traffic not recording data on iphone
 
 
Q