如何在objective-c Xcode 6中添加多个通知



我正在尝试创建一个每天都会发出通知的应用程序。问题是我希望应用程序每天都能发出不同的通知。在寻求帮助之前,我已经对此进行了大量研究。非常感谢!也许这是一个我不知道的数组?

 NSDate *AlarmTime = [[NSDate date] dateByAddingTimeInterval:5];
UIApplication *app = [UIApplication sharedApplication];
UILocalNotification *notifyAlarm = [[UILocalNotification alloc] init];
if (notifyAlarm) {
    notifyAlarm.fireDate = AlarmTime;
    notifyAlarm.timeZone = [NSTimeZone defaultTimeZone];
    notifyAlarm.repeatInterval = 0;
    notifyAlarm.soundName = @"Soundy.wav";
    notifyAlarm.alertBody = @"Go Back and learn more random facts!";
    [app scheduleLocalNotification:notifyAlarm];

处理此问题的最佳方式是服务器,而不是应用程序。这给了你两个强大的优势:

您可以在不更新应用程序的情况下远程调节传入的通知。您可以添加代码来查看是否看到/响应了应用程序推送通知。

最新更新