The Dual Nature of Live Photo Data
When uploading assets from an iOS device, a critical privacy concern arises: location data. While stripping EXIF data from standard JPEGs is a common practice, iOS Live Photos present a more complex challenge. A Live Photo is not a single entity but a composite of a still image and a short video clip. The standard EXIF scrubbers often only address the still image component, leaving the paired video file, or its associated metadata, vulnerable to exposing sensitive location information like GPS coordinates.
This oversight can lead to a failure case where the JPEG derivative of the Live Photo appears clean, but the underlying video metadata, or the original file associated with it, still contains the location data. This can happen during the initial upload or in retry paths, making it essential to handle both components of the Live Photo.
Identifying All Asset Resources
To effectively scrub location data, the first step is to identify all the constituent resources that make up an iOS asset. Apple's Photos framework provides the PHAssetResource class for this purpose. By querying PHAssetResource.assetResources(for: asset), developers can obtain an array of all resources associated with a given PHAsset. This array will include entries for both the still image and the video components of a Live Photo.
Iterating through this array allows developers to examine each resource individually. For each resource, properties like .uniformTypeIdentifier can be checked to determine its type (e.g., HEVC, JPEG, QuickTime). This granular understanding is key to applying the correct scrubbing logic to each part of the Live Photo.

Scrubbing Location Data from Image Resources
For the image component (typically a JPEG or HEIC), the process involves removing EXIF metadata. Libraries like ImageIO in Objective-C or various third-party Swift libraries can be used to read and write image metadata. The core task is to locate the GPS dictionary within the EXIF tags and remove it. If the image format is JPEG, the metadata is typically stored within the APP1 segment.
When dealing with HEIC files, the metadata handling might differ slightly, but the principle remains the same: access the metadata, find the GPS information, and strip it. It's crucial to ensure that this scrubbing process does not corrupt the image data itself. After stripping the metadata, the modified image data should be saved or uploaded.
Addressing Location Data in Video Resources
The video component of a Live Photo is often a QuickTime movie file (e.g., with a .mov extension). Unlike still images, video files can embed metadata in various ways, including within the file's atoms or as separate sidecar files. A common approach for QuickTime movies is to examine the metadata track. The AVFoundation framework in iOS provides tools for working with video assets and their metadata.
Using AVAsset, developers can access the metadata properties. Specifically, they would look for metadata items with identifiers related to GPS location (e.g., AVMetadataKey.quickTimeUserDataKey or specific GPS keys within the metadata dictionary). Once identified, these metadata items should be removed from the asset. This often involves creating a new, modified asset or modifying the existing one in place, depending on the framework's capabilities and whether the file is mutable.
The surprising detail here is that the video component, often overlooked, can be the primary vector for location leakage. Developers must actively target this part of the asset.
Implementing a Robust Upload Strategy
A comprehensive upload strategy should incorporate a resource inventory step. Before any upload commences, the application should enumerate all resources associated with the asset. For each resource, it should determine its type and apply the appropriate scrubbing mechanism. If a resource is an image, strip EXIF GPS data. If it's a video, strip its embedded metadata GPS information.
Consider a scenario where the upload fails and requires a retry. The retry logic must also incorporate this dual-scrubbing process. It's not enough to scrub the data once; the scrubbing must be part of the pipeline that prepares any asset for upload. This ensures that even if the initial upload fails and a different version or path is used for retry, the location data remains protected.
The build process for handling these assets should be defensive. This means assuming that all assets *might* contain sensitive data and building the process to explicitly remove it, rather than assuming it's already gone. This is akin to building a firewall not just at the perimeter, but also within the network's internal segments – a defense-in-depth approach for user privacy.
The Unanswered Question of User Consent and Defaults
While developers can implement technical solutions to strip location data, a broader question remains: what should be the default behavior for Live Photos? Should users be prompted explicitly about location data in both components of a Live Photo? Currently, iOS offers privacy controls for location services, but the granular handling of data within composite media types like Live Photos isn't always front-of-mind for the average user. Ensuring user awareness and providing clear, actionable consent mechanisms, perhaps even defaulting to scrubbing location data for uploads unless explicitly overridden, would represent a significant step forward in user privacy protection.
This dual-scrubbing approach is not merely a technical nicety; it's a fundamental requirement for any application handling user-generated media, especially when privacy is paramount. By understanding the structure of Live Photos and employing targeted scrubbing techniques for both image and video components, developers can build more secure and trustworthy applications.
