如何在不使用情节提要的情况下创建通知内容扩展 [英] How do you create a notification content extension without using a storyboard

查看:49
本文介绍了如何在不使用情节提要的情况下创建通知内容扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个Notification Content Extension,以利用新的iOS 10丰富的通知.但是,在主应用程序中,我们不使用接口生成器.如何创建不使用故事板的内容扩展?

I want to create a Notification Content Extension to take advantage of the new iOS 10 rich notifications. 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. 像往常一样创建通知内容"扩展目标.

  1. Create the Notification Content extension target as you normally would.

从项目中删除情节提要文件

Remove the storyboard file from the project

从扩展程序的Info.plist中删除 NSExtensionMainStoryboard 条目.

Remove the NSExtensionMainStoryboard entry from the extension's Info.plist.

NSExtension 下的Info.plist中添加 NSExtensionPrincipalClass 的新条目.该值应为扩展的名称空间和主ViewController的类.例如,如果您的扩展名为 Pretty Notification ,而类为 PrettyNotificationViewController ,则应输入 Pretty_Notification.PrettyNotificationViewController .

Add a new entry of NSExtensionPrincipalClass to the Info.plist under NSExtension. The value should be the namespace of your extension and the class of the main ViewController. For example, if your extension is called Pretty Notification and the class is PrettyNotificationViewController, you would enter Pretty_Notification.PrettyNotificationViewController.

注意:您的主体类必须符合 UNNotificationContentExtension

Note: Your principal class must conform to UNNotificationContentExtension

这篇关于如何在不使用情节提要的情况下创建通知内容扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆