Skip to content

Fix RevenueCatUI build on older Xcode: use legacy AVPlayerItemDidPlayToEndTime#7003

Merged
alexrepty merged 2 commits into
mainfrom
alex/fix-video-notification-constant
Jun 15, 2026
Merged

Fix RevenueCatUI build on older Xcode: use legacy AVPlayerItemDidPlayToEndTime#7003
alexrepty merged 2 commits into
mainfrom
alex/fix-video-notification-constant

Conversation

@alexrepty

@alexrepty alexrepty commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Checklist

  • If applicable, unit tests
  • If applicable, create follow-up issues for purchases-android and hybrids

Motivation

The test_revenuecatui CI lane (RevenueCatUI on an older Xcode — iOS 15.5 simulator, pre-visionOS toolchain) fails to compile with type 'AVPlayerItem' has no member 'didPlayToEndTimeNotification'. This persisted after the earlier import AVFoundation fix (#7000).

Description

The Swift class-property form AVPlayerItem.didPlayToEndTimeNotification doesn't exist in the older AVFoundation SDK that lane builds against — it only resolves on newer Xcode, which is why local builds passed. Both usages now use the original NSNotification.Name.AVPlayerItemDidPlayToEndTime constant, available on every SDK since iOS 4. Same behavior, no deployment-target changes.

The watchOS-only sibling in VideoPlayerView.swift is updated too, to prevent the identical latent failure there.

Note: local Xcode can't reproduce the older-toolchain failure, so the real confirmation is the test_revenuecatui lane re-running green in CI.


Note

Low Risk
Compile-time API selection only; loop logic and runtime behavior stay the same on both code paths.

Overview
Fixes RevenueCatUI compile failures on older CI Xcode (pre–Swift 5.9 / Xcode 15) where AVPlayerItem.didPlayToEndTimeNotification is unavailable.

Video loop handling now picks the notification name at compile time: the modern AVPlayerItem.didPlayToEndTimeNotification when compiler(>=5.9), otherwise NSNotification.Name.AVPlayerItemDidPlayToEndTime. Applied in watchOS VideoPlayerView (.onReceive for manual loop) and UIKit VideoPlayerViewUIView (loop NotificationCenter observer). Playback and loop behavior are unchanged on supported SDKs.

Reviewed by Cursor Bugbot for commit 94823cc. Bugbot is set up for automated code reviews on this repo. Configure here.

@alexrepty

Copy link
Copy Markdown
Contributor Author

@RCGitBot please test spm-revenuecat-ui-ios-15

@github-actions

Copy link
Copy Markdown

🚀 Triggered spm-revenuecat-ui-ios-15Pipeline #39324

@ajpallares ajpallares left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense! Only a question + there's also the job check-api-changes-revenuecatui which is failing on CI

// This is less reliable than using the AVPlayerLooper.
// Unfortunately, that is not available on watchOS
.onReceive(notificationCenter.publisher(for: AVPlayerItem.didPlayToEndTimeNotification)) { _ in
.onReceive(notificationCenter.publisher(for: NSNotification.Name.AVPlayerItemDidPlayToEndTime)) { _ in

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be worth splitting this with #if compiler checks? Idk if there's any consequence on using the deprecated value. Will also be easier to remove when we stop supporting Xcode 14 (which will happen soonish)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a good call 👍

@alexrepty alexrepty force-pushed the alex/fix-video-notification-constant branch from e9e011a to 8d6019c Compare June 15, 2026 13:25
alexrepty and others added 2 commits June 15, 2026 15:34
…ToEndTime constant

The `test_revenuecatui` lane builds RevenueCatUI on an older Xcode (iOS 15.5
simulator, pre-visionOS toolchain) where the Swift class-property form
`AVPlayerItem.didPlayToEndTimeNotification` doesn't exist in the AVFoundation
SDK, breaking compilation even with `import AVFoundation`.

Switch both usages to the original `NSNotification.Name.AVPlayerItemDidPlayToEndTime`
constant, which is available on every SDK since iOS 4.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… legacy fallback

Use `AVPlayerItem.didPlayToEndTimeNotification` on Swift 5.9+ (Xcode 15+) and
fall back to `NSNotification.Name.AVPlayerItemDidPlayToEndTime` on older
toolchains where the class-scoped name doesn't exist.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@ajpallares ajpallares left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

@alexrepty

Copy link
Copy Markdown
Contributor Author

@RCGitBot please test

@alexrepty alexrepty merged commit 9b286f5 into main Jun 15, 2026
43 checks passed
@alexrepty alexrepty deleted the alex/fix-video-notification-constant branch June 15, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants