Exception: Could not instantiate class named AVPlayerViewController from storyboard

I saw that in the Storyboard object library there is the AVKit Player View Controller. So I dragged it into the main.storyboard and hooked up a segue to a button. I added the prepareForSegue to setup the player but it isn't even getting that far before the following exception is thrown.


** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named AVPlayerViewController'


I have just updated to the official XCode 7.1 and the tvOS 7.1 GM although the project was originally created with Beta 3.


I quick hunt around the form found someone else using the segue to setup the AVPlayer URL and start playback so I assume it did work. Am I missing something?


I will try creating an new project Single View project template from XCode 7.1 to see if that works.

Replies

Not only do you have to @import AVKit, and @import AVFoundation, you have to also import both frameworks into your project. Here is a link to how to import frameworks under Build Settings: https://developer.apple.com/library/ios/recipes/xcode_help-project_editor/Articles/AddingaLibrarytoaTarget.html