Migrating a tvOS sectioned style top shelf from using TVTopShelfProvider, now deprecated, to TVTopShelfContentProvider causes an NSException on launch.
The error, NSExtensionPrincipalClass product_module_name.ContentProvider must implement at least one public protocol suggests that my class, ContentProvider, must use a protocol. TVTopShelfContentProvider is a class and not a protocol though.
Looking at Apple's example project you can see that they also only subclass TVTopShelfContentProvider.
Minimal example:
class ContentProvider: TVTopShelfContentProvider {
override func loadTopShelfContent(completionHandler: @escaping (TVTopShelfContent?) -> Void) {
requestMediaItemsIfNeeded {
let itemCollection: TVTopShelfItemCollection = TVTopShelfItemCollection(items: self.items)
itemCollection.title = "Collection Title"
let sectionedContent: TVTopShelfSectionedContent = TVTopShelfSectionedContent(sections: [itemCollection])
completionHandler(sectionedContent)
}
}
}
Top shelf related Info.plist values:
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.tv-top-shelf</string>
<key>NSExtensionPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).ContentProvider</string>
</dict>
Am I missing a project configuration value that needs to be added/updated? Created a new minimal top shelf extension and these look to be the only changes needed.
