2

我正在开发一个带有 phonegap 的 IOS 应用程序,需要为其设置本地通知,该通知将在每个星期五和指定时间重复

还要求用户决定是否接收本地通知

4

1 回答 1

3

我建议您阅读以下有关该主题的文章,我觉得这很有帮助

http://useyourloaf.com/blog/2010/7/31/adding-local-notifications-with-ios-4.html

- (void)scheduleNotification {

    [[UIApplication sharedApplication] cancelAllLocalNotifications];

        UILocalNotification *notif = [[UILocalNotification alloc] init];
        notif.fireDate = [datePicker date];
        notif.timeZone = [NSTimeZone defaultTimeZone];

        notif.alertBody = @"Body";
        notif.alertAction = @"AlertButtonCaption";
        notif.soundName = UILocalNotificationDefaultSoundName;
        notif.applicationIconBadgeNumber = 1;

       [[UIApplication sharedApplication] scheduleLocalNotification:notif];
        [notif release];
    }
}

这只是其工作原理的基本概述,但从这里开始,您应该能够安排通知。

于 2012-03-02T07:35:27.573 回答