Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ユーザーに通知許可を確認
- UIApplication.sharedApplication().registerUserNotificationSettings(UIUserNotificationSettings(forTypes: [.Alert, .Badge, .Sound], categories: nil))
- let notification = UILocalNotification()
- // 10秒後に通知
- notification.fireDate = NSDate(timeIntervalSinceNow: 10)
- notification.timeZone = NSTimeZone.defaultTimeZone()
- notification.alertBody = "Alert Body"
- notification.alertAction = "OK"
- // Custom Sound
- notification.soundName = "sample.mp3";
- // Default Sound
- notification.soundName = UILocalNotificationDefaultSoundName
- UIApplication.sharedApplication().scheduleLocalNotification(notification);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement