- 追加された行はこの色です。
- 削除された行はこの色です。
&tag(iOSSDK/Local Notification);
*目次 [#e03ddaa4]
#contents
*参考情報 [#le1a12d2]
-[[https://developer.apple.com/jp/devcenter/ios/library/documentation/RemoteNotificationsPG.pdf:https://developer.apple.com/jp/devcenter/ios/library/documentation/RemoteNotificationsPG.pdf]]…アップルのガイドPDF。
*基本 [#v8302655]
**通知の設定 [#bed38034]
-UILocalNotificationを生成し、UIApplicationに登録する
#pre{{
UILocalNotification *notification = [[UILocalNotification alloc] init];
//通知日時
notification.fireDate = [[NSDate date] addTimeInterval:5];
//タイムゾーン
notification.timeZone = [NSTimeZone defaultTimeZone];
//メッセージ
notification.alertBody = @"Notification";
//アクション
notification.alertAction = @"Open";
//サウンド
notification.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication] scheduleLocalNotification:notification];
}}
**通知のキャンセル [#j852b451]
-全ての通知をキャンセルする場合
#pre{{
[[UIApplication sharedApplication] cancelAllLocalNotifications];
}}