注册本地通知 [英] Register for Local Notification

查看:95
本文介绍了注册本地通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am developing an IOS application with phonegap and need to set local notification for it which will repeat on every friday and specified time

此外还要求用户将决定接收或不接收本地通知

Also there is requirement that user will decide to receive or not the local notification

推荐答案

我建议你阅读以下关于我发现非常有用的主题的文章

I recommend you read the following article on the topic which i found very helpful

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];
    }
}

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

This is just a basic outline of how it works but starting from this you should be able to schedule a notification.

这篇关于注册本地通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆