Skip to content

fix: Add watchOS to AVAssetDownloadTask availability check#344

Merged
kean merged 1 commit intokean:mainfrom
KYHyeon:fix/tvos-watchos-avassetdownloadtask
Sep 3, 2025
Merged

fix: Add watchOS to AVAssetDownloadTask availability check#344
kean merged 1 commit intokean:mainfrom
KYHyeon:fix/tvos-watchos-avassetdownloadtask

Conversation

@KYHyeon
Copy link
Copy Markdown
Contributor

@KYHyeon KYHyeon commented Sep 1, 2025

Summary

Fix build failures on tvOS and watchOS platforms caused by AVAssetDownloadTask unavailability.

Problem

The recent upstream commit (6dff47c) added a check to filter out AVAssetDownloadTask to prevent crashes during
swizzling. However, AVAssetDownloadTask is only available on iOS and macOS, causing compilation errors on tvOS and
watchOS:

❌ 'AVAssetDownloadTask' is unavailable in tvOS
❌ 'AVAssetDownloadTask' is unavailable in watchOS

Solution

Added platform-specific conditional compilation to exclude the AVAssetDownloadTask check on tvOS and watchOS:

#if !os(tvOS) && !os(watchOS)
    guard !task.isKind(of: AVAssetDownloadTask.self) else { return }
#endif

Why This Is Safe

1. tvOS/watchOS: AVAssetDownloadTask doesn't exist on these platforms, so no such tasks will ever be created. The
check can be safely skipped.
2. iOS/macOS: The check remains in place to prevent crashes when encountering AVAssetDownloadTask instances (used
for HLS streaming).

Testing

-  Builds successfully on all platforms (iOS, tvOS, watchOS, macOS)
-  No functional changes for iOS/macOS
-  Fixes compilation errors on tvOS/watchOS

Related Issues

- Fixes build failures in CI/CD pipelines for tvOS and watchOS targets
- Maintains compatibility with the upstream fix for AVAssetDownloadTask crash (commit 6dff47cd)

AVAssetDownloadTask is not available on watchOS either, not just tvOS.
Updated conditional compilation to exclude both tvOS and watchOS.
@kean kean merged commit 000cd7c into kean:main Sep 3, 2025
@kean
Copy link
Copy Markdown
Owner

kean commented Sep 3, 2025

Thank you!

@KYHyeon KYHyeon deleted the fix/tvos-watchos-avassetdownloadtask branch September 3, 2025 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants