will system loads Notification service extension and calls its didReceive(_:withContentHandler:)
for local notifications in iOS 10?
If yes how we can do that?
相关问题
- “Zero out” sensitive String data in Swift
- SwiftUI: UIImage (QRCode) does not load after call
- Get the NSRange for the visible text after scroll
- UIPanGestureRecognizer is not working in iOS 13
- What does a Firebase observer actually do?
相关文章
- Using if let syntax in switch statement
- Enum with associated value conforming to CaseItera
- Swift - hide pickerView after value selected
- Is there a Github markdown language identifier for
- How can I add media attachments to my push notific
- How can I vertically align my status bar item text
- Adding TapGestureRecognizer to UILabel in Swift
- Attempt to present UIAlertController on View Contr
Notification Service extension is for remote notification not for local notification.
As per apple doc
UNNotificationServiceExtension An object that modifies the content of a remote notification before it's delivered to the user.
No. The accepted answer describes Notification Content Extensions, which allow you to present a ViewController in the expanded notification view, and works with both remote and local notification.
Notification Service Extensions, that let you change the content of the notification (attaching images, etc) do not work with local notifications. However, you can attach images as part of the process to show a local notification.
Notification Extension is supported for local notifications too. It is clearly mentioned here
UNNotificationContentExtension An object that presents a custom interface for a delivered local or remote notification.
You need to create a Notification Content Extension for displaying custom notification with iOS10. In the Xcode menu bar, go to File->New->Target. Then from the list select Notification Content Extension.
Enter the corresponding details and click Finnish. You will see a new folder with the name of your extension. In the folder, there will be 3 files :
NotificationViewController : Here you can design your custom interface and implement responses.
MainStoryboard : You can use this to design your custom notification.
Info.plist
In the Info.plist file, add the following:
This will be the category identifier you will use in your main project when scheduling notifications.
Your NotificationViewController class should look something like this.
There are a couple of good tutorials available online. You can check here, here & here. Hope this helps.