[英]How do you create a notification content extension without using a storyboard
I want to create a Notification Content Extension to take advantage of the new iOS 10 rich notifications. 我想创建一个Notification Content Extension来利用新的iOS 10丰富通知。 However, in the main application we do not make use of interface builder.
但是,在主应用程序中,我们不使用接口构建器。 How can I create a content extension that does not utilize a story board?
如何创建不使用故事板的内容扩展?
Create the Notification Content extension target as you normally would. 像往常一样创建通知内容扩展目标。
Remove the storyboard file from the project 从项目中删除storyboard文件
Remove the NSExtensionMainStoryboard entry from the extension's Info.plist. 从扩展的Info.plist中删除NSExtensionMainStoryboard条目。
Add a new entry of NSExtensionPrincipalClass to the Info.plist under NSExtension . 添加NSExtensionPrincipalClass到NSExtension下Info.plist中的新条目。 The value should be the namespace of your extension and the class of the main ViewController.
该值应该是扩展的名称空间和主ViewController的类。 For example, if your extension is called Pretty Notification and the class is PrettyNotificationViewController , you would enter Pretty_Notification.PrettyNotificationViewController .
例如,如果您的扩展名为Pretty Notification ,而类是PrettyNotificationViewController ,则应输入Pretty_Notification.PrettyNotificationViewController 。
Note: Your principal class must conform to UNNotificationContentExtension 注意:您的主要类必须符合UNNotificationContentExtension
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.