Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- aps {
- content-available: 1
- alert: {...}
- }
- aps {
- content-available: 0
- alert: {...}
- }
- application.registerForRemoteNotifications() // This does NOT require user permission.
- UNUserNotificationCenter.current().requestAuthorization([.alert, .badge, .sound]) { (granted, error) in
- guard error == nil else {
- //Display Error.. Handle Error.. etc..
- return
- }
- if granted {
- //Do stuff here..
- //Register for RemoteNotifications. Your Remote Notifications can display alerts now :)
- application.registerForRemoteNotifications()
- }
- else {
- //Handle user denying permissions..
- }
- }
- {
- "aps" : {
- "content-available" : 1
- },
- "acme1" : "bar",
- "acme2" : 42
- }
- "aps" : {
- "alert" : "You got your emails.",
- "badge" : 9,
- "sound" : "bingbong.aiff"
- },
- "acme1" : "bar",
- "acme2" : 42
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement