2013年3月12日 星期二

使用本地通知

UILocalNotification *notification=[[UILocalNotification alloc] init];
if (notification!=nil) {
NSLog(@">> support local notification");
NSDate *now=[NSDate new];
notification.fireDate=[now addTimeInterval:10];
notification.timeZone=[NSTimeZone defaultTimeZone];
notification.alertBody=@"该去吃晚饭了!";
[[UIApplication sharedApplication] scheduleLocalNotification:notification];
}

至於顯示方式為banner或alert要視iOS的設定而定,無法在App中控制。

沒有留言:

張貼留言