NSLocalNotificationでネットワークにつなげることはできず、デバイスだけで完結してしまっている機能なので、facebookのようなメッセージがあったことを知らせるnotificationはPushNotificationで調べてください
(Notificationのapple公式ドキュメント => https://developer.apple.com/jp/devcenter/ios/library/documentation/RemoteNotificationsPG.pdf)
日本語です
ここではLocal Notificationの使い方を忘れないようにメモしておきます。
(参考にしたサイト => http://ameblo.jp/porcom-yokoyama/entry-11134501691.html)
コピペですww問題があったら消します
NSDate *now = [NSDate date]; NSDate *notifyTime = [now dateByAddingTimeInterval:10]; UILocalNotification *notify = [[UILocalNotification alloc] init]; notify.fireDate = notifyTime; notify.timeZone = [NSTimeZone defaultTimeZone]; notify.hasAction = YES; notify.alertBody = @"時間です。"; notify.alertAction = @"起動する。"; notify.soundName = UILocalNotificationDefaultSoundName; [[UIApplication sharedApplication] scheduleLocalNotification:notify];
上の参考リンクではNotificationの削除の仕方も載っているので、参考にしてください
No comments:
Post a Comment