Search code examples
avfoundationuistoryboardxcode9avplayerviewcontrolleravkit

Unknown class AVPlayerViewController in Interface builder file


I am adding AVPlayerViewController in storyboard, but when I run the app I get this error iOS device or simulator.

Unknown class AVPlayerViewController in Interface Builder file.

How do I fix it?


Solution

  • I found the issue. The issue was I was using @import AVKit in the code but there wasn't a single line in the code that initialized AVPlayerViewController, so effectively AVKit was not imported at runtime which caused warning of unknown class when loading Xib containing AVPlayerViewController.