我正在开发一个带有phonegap的IOS应用程序,需要为其设置本地通知,该通知将在每个星期五和指定时间重复
还要求用户决定是否接收本地通知
我建议您阅读以下有关该主题的文章,我发现它非常有帮助
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];
}
}
这只是其工作原理的基本概述,但从这里开始,您应该能够安排通知。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)