码迷,mamicode.com
首页 > 移动开发 > 详细

移动端通知

时间:2016-10-06 00:18:08      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:

步骤:

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!