How to set up push notifications in Swift

后端 未结 11 1198
生来不讨喜
生来不讨喜 2020-11-27 10:48

I am trying to set up a push notification system for my application. I have a server and a developer license to set up the push notification service.

I am currently

11条回答
  •  野性不改
    2020-11-27 11:46

    I use this code snip in AppDelegate.swift:

    let pushType = UIUserNotificationType.alert.union(.badge).union(.sound)
    let pushSettings = UIUserNotificationSettings(types: pushType
                , categories: nil)
    
    application.registerUserNotificationSettings(pushSettings)
    application.registerForRemoteNotifications()
    

提交回复
热议问题