标签:
步骤:
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
标签:
原文地址:http://www.cnblogs.com/jackyzhong123/p/5933205.html