Migrate MIME-type lookup to UTType (UniformTypeIdentifiers)

Replace the deprecated CoreServices UTI calls
(UTTypeCreatePreferredIdentifierForTag / UTTypeCopyPreferredTagWithClass)
in GCDWebServerGetMimeTypeForExtension with the modern
[UTType typeWithFilenameExtension:].preferredMIMEType, removing the
-Wdeprecated-declarations pragma. Behavior is unchanged: known
extensions map to the same MIME type, unknown ones fall back to the
default.

The UniformTypeIdentifiers framework (macOS 11+ / iOS 14+ / tvOS 14+,
within the project's deployment targets) is now linked in all three
build systems: Xcode (OTHER_LDFLAGS), CocoaPods (Core subspec
frameworks), and SwiftPM (linkedFramework).

Verified: Run-Tests.sh, swift build, and pod lib lint all pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-08 16:57:23 +07:00
parent 4a49a6fa02
commit fe0036eb7e
5 changed files with 7 additions and 12 deletions

View File

@ -44,7 +44,7 @@ This script was originally written for Xcode 11.3 and was updated for current Xc
- The `webUploader` fixture test is **commented out**: this fork customized `GCDWebUploader` (delete/move/create disabled in commit `ef4b622`), so the recorded `Tests/WebUploader` fixtures no longer match. Re-record them or re-enable the line if those features are restored.
- The **tvOS build step is commented out** because it requires the tvOS Simulator runtime to be installed (`xcodebuild -downloadPlatform tvOS`); without it the storyboard compile fails with "tvOS … Platform Not Installed". Re-enable once the runtime is present.
Two project/source adjustments were also needed for the suite to build under current Xcode: the `Tests (Mac)` target sets `GENERATE_INFOPLIST_FILE = YES`, and the deprecated CoreServices UTI calls in `GCDWebServerFunctions.m` are wrapped in a `-Wdeprecated-declarations` pragma (the project builds Release with `-Werror`).
A project adjustment was also needed for the suite to build under current Xcode: the `Tests (Mac)` target sets `GENERATE_INFOPLIST_FILE = YES`. MIME-type lookup in `GCDWebServerFunctions.m` uses the modern `UTType` API (UniformTypeIdentifiers), so that framework is linked in all three build systems (Xcode `OTHER_LDFLAGS`, the podspec Core subspec, and `Package.swift`).
### How the fixture-replay tests work