func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
//1.创建UIUserNotificationSettings,并设置消息的显示类类型
let pushtypes : UIUserNotificationType = [UIUserNotificationType.Badge,UIUserNotificationType.Alert,UIUserNotificationType.Sound]
let userSetting = UIUserNotificationSettings(forTypes: pushtypes , categories:nil)
//2.注册推送
//本地通知只有app位于后台才会显示
application.registerUserNotificationSettings(userSetting)
//远程通知
//application.registerForRemoteNotificationTypes([UIRemoteNotificationType.Alert,UIRemoteNotificationType.Badge,UIRemoteNotificationType.Sound])
//3.添加本地推送和设置固定时间推送了
self.sendNotification()
}
//添加本地推送和设置固定时间推送了
func sendNotification( ) {
// //取消所有的本地通知
UIApplication.sharedApplication().ca