Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let notificationTypes:UIUserNotificationType = UIUserNotificationType.Badge | UIUserNotificationType.Sound | UIUserNotificationType.Alert
- let notificationSettings:UIUserNotificationSettings = UIUserNotificationSettings(forTypes: notificationTypes, categories: nil)
- UIApplication.sharedApplication().registerUserNotificationSettings(notificationSettings)
- UIApplication.sharedApplication().registerForRemoteNotifications()
- if(application.applicationState == UIApplicationState.Active) {
- var ln: UILocalNotification = UILocalNotification()
- ln.userInfo = userInfo
- ln.soundName = UILocalNotificationDefaultSoundName
- ln.alertBody = notification["alert"] as NSString
- ln.fireDate = NSDate()
- application.scheduleLocalNotification(ln)
- println("local")
- } else {
- PFPush.handlePush(userInfo)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement