Fix RevenueCatUI build on older Xcode: use legacy AVPlayerItemDidPlayToEndTime#7003
Merged
Conversation
Contributor
Author
|
@RCGitBot please test spm-revenuecat-ui-ios-15 |
|
🚀 Triggered spm-revenuecat-ui-ios-15 → Pipeline #39324 |
ajpallares
reviewed
Jun 15, 2026
ajpallares
left a comment
Member
There was a problem hiding this comment.
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 |
Member
There was a problem hiding this comment.
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)
Contributor
Author
There was a problem hiding this comment.
Yeah, that's a good call 👍
e9e011a to
8d6019c
Compare
…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>
8d6019c to
94823cc
Compare
Contributor
Author
|
@RCGitBot please test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
purchases-androidand hybridsMotivation
The
test_revenuecatuiCI lane (RevenueCatUI on an older Xcode — iOS 15.5 simulator, pre-visionOS toolchain) fails to compile withtype 'AVPlayerItem' has no member 'didPlayToEndTimeNotification'. This persisted after the earlierimport AVFoundationfix (#7000).Description
The Swift class-property form
AVPlayerItem.didPlayToEndTimeNotificationdoesn'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 originalNSNotification.Name.AVPlayerItemDidPlayToEndTimeconstant, available on every SDK since iOS 4. Same behavior, no deployment-target changes.The watchOS-only sibling in
VideoPlayerView.swiftis 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_revenuecatuilane 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.didPlayToEndTimeNotificationis unavailable.Video loop handling now picks the notification name at compile time: the modern
AVPlayerItem.didPlayToEndTimeNotificationwhencompiler(>=5.9), otherwiseNSNotification.Name.AVPlayerItemDidPlayToEndTime. Applied in watchOSVideoPlayerView(.onReceivefor manual loop) and UIKitVideoPlayerViewUIView(loopNotificationCenterobserver). 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.