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

后端 未结 1 1149
-上瘾入骨i
-上瘾入骨i 2021-02-15 11:43

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 build

相关标签:
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

    0 讨论(0)
提交回复
热议问题