简体   繁体   English

如何在不使用故事板的情况下创建通知内容扩展

[英]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? 如何创建不使用故事板的内容扩展?

  1. Create the Notification Content extension target as you normally would. 像往常一样创建通知内容扩展目标。

  2. Remove the storyboard file from the project 从项目中删除storyboard文件

  3. Remove the NSExtensionMainStoryboard entry from the extension's Info.plist. 从扩展的Info.plist中删除NSExtensionMainStoryboard条目。

  4. Add a new entry of NSExtensionPrincipalClass to the Info.plist under NSExtension . 添加NSExtensionPrincipalClassNSExtension下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.

相关问题 如何使用通用情节提要板在xcode 6中创建7.1应用程序? - How do you create a 7.1 app in xcode 6 using a universal storyboard? 如何创建没有情节提要的UNNotificationContentExtension? - How do I create a UNNotificationContentExtension without a Storyboard? 如何在不使用故事板的情况下创建UICollectionView? - How to create UICollectionView without using the storyboard? 是否可以在不使用情节提要的情况下,在xib文件中创建原型内容UITableview? - Is it possible to create a prototype content UITableview in a xib file without using storyboard? IOS通知内容扩展:在storyboard中添加按钮并处理点击动作 - IOS notification content extension: add buttons in storyboard and handle the click action 如何禁用情节提要? - How do you disable storyboard? 如何关闭通知内容扩展? - How to close notification content extension? 如何在没有共享 UI 的情况下在 iOS8 中创建共享扩展 - How do you create a Share Extension in iOS8 without a share UI iOS Storyboard:如何在UIScrollView中编辑大于屏幕的内容视图 - iOS Storyboard: how do you edit a content view larger than screen in a UIScrollView 如何在Storyboard设计中创建accessoryInputView? - How can you create an accessoryInputView in a Storyboard design?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM