How do you create a notification content extension without using a storyboard

时光怂恿深爱的人放手 提交于 2019-12-21 04:28:13

问题


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.

  2. Remove the storyboard file from the project

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

  4. 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.

Note: Your principal class must conform to UNNotificationContentExtension



来源:https://stackoverflow.com/questions/39882188/how-do-you-create-a-notification-content-extension-without-using-a-storyboard

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!