如何在应用中将警报实施为本地通知?

时间:2016-03-01 06:54:11

标签: ios objective-c xcode

如何在app My Example code:

中将警报实施为本地通知
UILocalNotification* localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = pickerDate;
localNotification.alertBody = self.itemText.text;
localNotification.alertAction = @"Show me the item";
localNotification.timeZone = [NSTimeZone defaultTimeZone];
localNotification.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber] + 1;

由于

1 个答案:

答案 0 :(得分:0)

 [[UIApplication sharedApplication] scheduleLocalNotification:localNotification];

在代码末尾添加此内容&确保选择有效日期&通知启动的时间。