Hi there,
I have some code that's been working fine for the last few versions of iOS and macOS and all the others, and now causes a runtime crash in iOS 18/macOS 15 etc.
I have an actor called Player which is basically a big wrapper around an AVPlayer. It all gets compiled down to a Framework, and my clients use it by dropping it in to their video player app code. It handles everything needed for them to be able to talk to our media infrastructure and handles telemetry.
It has its own property called avplayer which is an AVPlayer. Gets created at the init().
It has a function called load(_ avPlayerItem: AVPlayerItem) which the clients use to load a new video into player.
The offending code (which used to work!) looks like this:
Task { @MainActor in
avplayer.replaceCurrentItem(with: avPlayerItem)
}
No warnings in Xcode. When you run it, it crashes on iOS 18 and macOS 15 with this error in the debugger:
Incorrect actor executor assumption
I thought, "Okay well maybe replaceCurrentItem has changed and doesn't need to be on the main actor anymore, so even if you say this outside of a Main Actor-scoped task:
avplayer.replaceCurrentItem(with: avPlayerItem)
...it still crashes the exact same way.
Does anyone have any ideas? I'm under some heavy pressure here to get this working and I don't even know where to start with this.
Big thanks in advance.
Post
Replies
Boosts
Views
Activity
For whoever needs to hear this...
Say you have an AVURLAsset:
let asset = AVURLAsset(url: URL(string: "https://www.example.com/playlist.m3u8")!)
Then say you load that asset into an AVPlayerItem, and would like it to automatically load certain asset keys you're interested in ahead of time:
let playerItem = AVPlayerItem(
asset: avURLAsset,
automaticallyLoadedAssetKeys: [
"metadata",
"commonMetadata",
"availableMetadataFormats",
"allMediaSelections",
"hasProtectedContent",
"overallDurationHint"])
Among those keys, do not use "tracks" even though it's one of the available options. That will break AirPlay across all platforms (the user chooses an AirPlay destination and the AVPlayerItem's status instantly switches to failed).
Took me far too long to track this down, just wanted to get it out there to save anybody else some time if they ever run into it.
I'm just putting this here for visibility, I already submitted FB13688825.
If you say this:
Task {
for await tracks in avPlayerItem.publisher(for: \.tracks, options: [.initial]).values {
print("*** fired with: \(tracks.description)")
}
}
...it fires once with: "*** fired with: []"
If you say this:
avPlayerItem.publisher(for: \.tracks).sink { [weak self] tracks in
print("*** fired with: \(tracks.description)")
}.store(in: &subscriptions)
...you get, as expected, multiple fires, most with data in them such as: *** fired with: [<AVPlayerItemTrack: 0x10a9869a0, assetTrack = <AVAssetTrack: 0x10a9869f0...
I think it's a bug but I'm just going to go back to the "old way" for now. No emergency.
Hello there,
I understand most components of the FairPlay Streaming Server SDK haven't been updated in about a decade, but the verify_ckc tool no longer works, and it's really helpful. It throws errors when trying to import the Crypto library...probably something to do with this whole Python 2 vs Python 3 thing.
I don't know anything about Python or I'd try to fix it myself but...I'm just bringing this up in case anyone from the FairPlay team reads these things!
Thx
(Sometimes I think I'm the only person who's actually using the new Xcode multiplatform app paradigm! So hard finding info on the various "gotchas".)
My multiplatform app supports macOS (not Catalyst), iOS, iPadOS, and tvOS. It's an internal testing app, never meant to be on any app store.
It has only one Target (the new multiplatform target).
I've been able to work through all the teething issues except for Entitlements. My iOS and tvOS app both use 3 entitlements that are for those platforms only. The macOS version doesn't need or want them. But if those 3 entitlements are in the .entitlements file, the macOS version won't launch at all (not even in the sim).
Of course as soon as I take those 3 entitlements out of the file, it runs.
Sooo...in a multiplatform targeted app how do you specify different entitlements for different platforms? Or is it not possible?
Thanks!
Hi,
In this article here:
https://developer.apple.com/documentation/xcode/interacting-with-your-app-in-the-tvos-simulator#Navigate-using-a-physical-remote-control
...it gives steps on how to pair the Siri Remote so that it works with the simulator. However, when I follow the steps, the remote shows up in the Bluetooth list as a "generic device" only labelled by its serial number, and it definitely can't control the simulator.
Just me?
Hello there,
I'd like to add a custom URL scheme to my app (whose target is configured as a multiplatform app).
Usually we do this by going to project settings, select the target, click the Info tab, and disclose the URL Types heading, but that's missing when the target is multiplatform. I'm able to create an all-new target that does have the heading, but that seems to be defeating the purpose.
If you've got any ideas I'd appreciate it!
Thanks