1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SwiftでのlocalNotification

Last updated at Posted at 2015-08-05

登録

swift
UIApplication.sharedApplication().registerUserNotificationSettings(UIUserNotificationSettings(forTypes: UIUserNotificationType.Sound | UIUserNotificationType.Alert | UIUserNotificationType.Badge, categories: nil))

#通知の登録

ndate = NSDate() // ndateには好きな時間をNSDate形式で指定
var notification = UILocalNotification()
notification.fireDate = ndate
notification.timeZone = NSTimeZone.defaultTimeZone()
notification.alertBody = "BODY" // 通知メッセージ内容
notification.alertAction = "OPEN" // ダイアログのボタンラベル
notification.soundName = UILocalNotificationDefaultSoundName
UIApplication.sharedApplication().scheduleLocalNotification(notification);
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?