首页 > 代码库 > 移动端通知

移动端通知

步骤:

1. 添加框架 UserNotifications

2. 注册远程通知

let center = UNUserNotificationCenter.current()    center.requestAuthorization(options: [.alert, .sound, .badge]) { (granted, error) in        // Enable or disable features based on authorization.        if granted == true        {            print("Allow")            UIApplication.shared.registerForRemoteNotifications()        }        else        {            print("Don‘t Allow")        }    }

3. 获取Token

 

移动端通知