iOS 10推送
iOS 10前后两种本地通知:http://blog.csdn.net/cloudox_/article/details/75116240
iOS 开发中,怎样用好 Notifications?:http://www.jianshu.com/p/f20b00c1fc24
远程推送
iOS开发之实现App消息推送:http://blog.csdn.net/shenjie12345678/article/details/41120637
国内90%以上的iOS开发者,对APNs的认识都是错的:http://www.jianshu.com/p/ace1b422bad4
本地推送
参考文章:
API参考官方文档:
注册通知:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
// Override point for customization after application launch. if(UIApplication.instancesRespondToSelector(Selector("registerUserNotificationSettings:"))) {
UIApplication.sharedApplication().registerUserNotificationSettings(UIUserNotificationSettings(forTypes: .Alert | .Badge, categories: nil))
} return true
}
The first time the applications starts the user is asked for permission to show an alert or badge notification. if the application isn't running the user will see a banner displayed and a badge. By tapping on action button of the notification, users will launch the app. In this case, this method is called.
如果触发通知时app正在运行:
func application(application: UIApplication, didReceiveLocalNotification notification: UILocalNotification) {
application.applicationIconBadgeNumber = 0
}
If the app is running while the notification is delivered, there is no alert displayed on screen. The application automatically calls this method.