Skip to content

Measurement Context and Privacy (iOS)

The iOS SDK records network and location context while a quality test runs. This is similar to Androidm, but iOS does not provide a public App Store API for all the information.

The data is returned in connection_detail_trace and geolocation_trace and uploaded to the configured Surfmeter server as part of the measurement. See Measurement Data for the exact fields.

Collection Lifecycle

The collectors start when the test starts and stop when it completes or aborts. They do not run between tests.

The SDK adds an initial connection snapshot as soon as NWPathMonitor reports the network state. Network-path updates and cellular radio-technology notifications trigger another collection immediately. A ten-second poll also catches details such as IP address or SSID changes. The SDK emits a new snapshot only when an available field changed.

The SDK records each valid precise location update delivered by Core Location. It requests the best available accuracy, uses a one-meter distance filter, and does not pause location updates automatically while the test runs. iOS controls the actual update timing.

Location Permission

The SDK does not request location authorization. Your host app must explain why the measurement needs precise location and ask for When In Use access before starting a test.

Add a purpose string to the host target's Info.plist:

<key>NSLocationWhenInUseUsageDescription</key>
<string>Surfmeter records precise location during professional network quality tests so results can be compared by place and network conditions. Location is sent to the configured Surfmeter server only as part of a test result.</string>

Retain a CLLocationManager in the host app and use it to request access from an appropriate screen:

import CoreLocation

final class MeasurementLocationAccess: NSObject, CLLocationManagerDelegate {
    private let manager = CLLocationManager()

    override init() {
        super.init()
        manager.delegate = self
    }

    func requestWhenInUseAccess() {
        manager.requestWhenInUseAuthorization()
    }
}

Note that you must request access before starting a test. Do not wait for permission inside the test lifecycle.

Precise location is the recommended setting for a professional measurement app. For now, our SDK deliberately does not record approximate coordinates. In these cases, geolocation_trace remains empty.

Temporary Precise Access

If the user granted approximate location, the app can offer a temporary precise-location request. Add a purpose key to Info.plist:

<key>NSLocationTemporaryUsageDescriptionDictionary</key>
<dict>
    <key>ProfessionalMeasurement</key>
    <string>Precise location identifies the place and network conditions represented by this professional measurement.</string>
</dict>

Use the same purpose key when requesting full accuracy:

manager.requestTemporaryFullAccuracyAuthorization(
    withPurposeKey: "ProfessionalMeasurement"
)

The demo app shows this flow and directs users to Settings when access was denied.

Wi-Fi SSID and BSSID

The basic connection trace needs no entitlement. To let the SDK include ssid and bssid, add Apple's Access WiFi Information capability to the host target:

  1. Open the app target in Xcode.
  2. Select Signing & Capabilities.
  3. Select + Capability and add Access WiFi Information.
  4. Ensure that the provisioning profile contains the capability.

The resulting entitlement is:

<key>com.apple.developer.networking.wifi-info</key>
<true/>

The capability does not guarantee that iOS returns the network name. The SDK includes SSID and BSSID only when NEHotspotNetwork.fetchCurrent makes them available. Location authorization is the normal way a professional measurement app satisfies the related privacy condition. If iOS returns no Wi-Fi identity, the connection snapshot remains valid and simply omits ssid and bssid.

Differences from Android

Both SDKs use the same trace names and shared field names. Android however exposes more radio and Wi-Fi diagnostics than iOS.

iOS has no public App Store API for these Android fields:

  • Wi-Fi RSSI, normalized signal strength, frequency, or link speed
  • cellular signal strength such as dBm, RSRP, RSRQ, or SINR
  • cell identity, channel, and area codes
  • a reliable carrier, MCC/MNC, or roaming state for this measurement

The iOS SDK omits these fields instead of estimating them. It can record the active interface, reachability, whether the path is expensive, local IP address and prefix length, Wi-Fi SSID/BSSID when permitted, and the current cellular radio technology. A cellular radio-technology change creates a new trace entry. Signal-strength changes cannot do so because iOS does not expose the value.

Privacy Manifest and App Disclosures

For completeness, SDK includes PrivacyInfo.xcprivacy. It declares:

  • precise location
  • the registered device identifier
  • performance data
  • other diagnostic data
  • other connection and measurement context

The manifest marks these values as linked to the registered client, used for app functionality, and not used for tracking. It also declares the required-reason API use for UserDefaults and file timestamps.