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

@ -1169,6 +1169,7 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
BUNDLE_VERSION_STRING = 3.5.4;
OTHER_LDFLAGS = "-framework UniformTypeIdentifiers";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
@ -1239,6 +1240,7 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
BUNDLE_VERSION_STRING = 3.5.4;
OTHER_LDFLAGS = "-framework UniformTypeIdentifiers";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;