Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. let notificationTypes:UIUserNotificationType = UIUserNotificationType.Badge | UIUserNotificationType.Sound | UIUserNotificationType.Alert
  2. let notificationSettings:UIUserNotificationSettings = UIUserNotificationSettings(forTypes: notificationTypes, categories: nil)
  3. UIApplication.sharedApplication().registerUserNotificationSettings(notificationSettings)
  4. UIApplication.sharedApplication().registerForRemoteNotifications()
  5.  
  6. if(application.applicationState == UIApplicationState.Active) {
  7. var ln: UILocalNotification = UILocalNotification()
  8. ln.userInfo = userInfo
  9. ln.soundName = UILocalNotificationDefaultSoundName
  10. ln.alertBody = notification["alert"] as NSString
  11. ln.fireDate = NSDate()
  12. application.scheduleLocalNotification(ln)
  13. println("local")
  14. } else {
  15. PFPush.handlePush(userInfo)
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement