Different WebRTC ICE behavior between Xcode Release build and TestFlight on the same device

Hi everyone,

I'm experiencing a very unusual difference in WebRTC ICE behavior between an application installed directly from Xcode and the exact same application distributed through TestFlight.

Environment iOS application using Google's official WebRTC framework Same iPhone/iPad Same iOS version Same cellular network Same TURN server Xcode Run configuration: Release Archive configuration: Release Configuration

The following configuration works perfectly when the application is installed directly from Xcode:

config.iceTransportPolicy = .all

config.iceServers = [

RTCIceServer(
    urlStrings: [
        "turn:turn.example.com:3478?transport=udp"
    ],
    username: "username",
    credential: "<hidden>"
),

RTCIceServer(
    urlStrings: [
        "turn:turn.example.com:443?transport=tcp"
    ],
    username: "username",
    credential: "<hidden>"
),

RTCIceServer(
    urlStrings: [
        "turns:turn.example.com:5349?transport=tcp"
    ],
    username: "username",
    credential: "<hidden>"
),

RTCIceServer(
    urlStrings: [
        "stun:stun.l.google.com:19302"
    ]
)

]

Calls connect quickly on both Wi-Fi and cellular networks.

Problem

After uploading exactly the same application to TestFlight, behavior changes significantly on cellular networks.

ICE gathering appears to spend a long time generating host/server-reflexive candidates before a usable relay candidate becomes available.

As a result, connection establishment becomes much slower than the same Release build installed directly from Xcode.

Temporary workaround

The only configuration that currently behaves reliably in TestFlight is forcing relay-only with a single TURN UDP server:

config.iceTransportPolicy = .relay

config.continualGatheringPolicy = .gatherContinually config.iceCandidatePoolSize = 2

config.iceServers = [ RTCIceServer( urlStrings: [ "turn:turn.example.com:3478?transport=udp" ], username: "username", credential: "<hidden>" ) ]

This connects quickly and reliably on both Wi-Fi and cellular networks.

My question

Has anyone experienced different ICE gathering or candidate selection behavior between:

a Release build installed directly from Xcode the same Release build distributed through TestFlight

on the same device and network?

Are there any known differences in networking, ICE gathering, or runtime behavior that could explain this?

I'd appreciate any suggestions or similar experiences.

Thanks!

Answered by DTS Engineer in 897907022
After uploading exactly the same application to TestFlight

As a first step I want to confirm what you mean by “exactly the same application”. My recommendation here is that you do Product > Archive and then use the Xcode organiser to export a Development signed build for local testing and a Distribution signed build for TestFlight. This will have exactly the same built binary, so if they behave differently then you know for sure that this is a code signing or distribution channel issue.

I talk about this idea in more detail in Isolating Code Signing Problems from Build Problems.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

After uploading exactly the same application to TestFlight

As a first step I want to confirm what you mean by “exactly the same application”. My recommendation here is that you do Product > Archive and then use the Xcode organiser to export a Development signed build for local testing and a Distribution signed build for TestFlight. This will have exactly the same built binary, so if they behave differently then you know for sure that this is a code signing or distribution channel issue.

I talk about this idea in more detail in Isolating Code Signing Problems from Build Problems.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Different WebRTC ICE behavior between Xcode Release build and TestFlight on the same device
 
 
Q