注册本地通知

时间:2012-03-02 07:33:13

标签: ios localnotification

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

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

1 个答案:

答案 0 :(得分: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];
    }
}

这只是它如何运作的基本概述,但从这开始你应该能够安排通知。