VideoPlayer crashes on Archive build

I have found that following code runs without issue from Xcode, either in Debug or Release mode, yet crashes when running from the binary produced by archiving - i.e. what will be sent to the app store.

import SwiftUI
import AVKit

@main
struct tcApp: App {
	var body: some Scene {
		WindowGroup {
			VideoPlayer(player: nil)
		}
	}
}

This is the most stripped down code that shows the issue. One can try and point the VideoPlayer at a file and the same issue will occur.

I've attached the crash log:

Please note that this was seen with Xcode 26.2 and MacOS 26.2.

Answered by peggers123 in 894608022

This appears to be a known issue where AVKit.framework is not linked, and then the class can't be found at runtime. Adding AVKit.framework to the target's Link build phase solves the problem.

As a follow up, three further points:

I tried this on someone else’s machine. Same issue. So it’s not a config issue with my Xcode / machine.

Secondly, one doesn’t need to go thru the archive step, just run the executable produced for the Xcode run.

Issue not seen if a debug build is used.

Accepted Answer

This appears to be a known issue where AVKit.framework is not linked, and then the class can't be found at runtime. Adding AVKit.framework to the target's Link build phase solves the problem.

VideoPlayer crashes on Archive build
 
 
Q