如何发送固定时间的推送通知?
How to send a push notification for a fixed hour?
我是新 IOS 开发人员,我以前从未使用过推送通知或本地。
用户需要设置一个小时,以获取推送通知。
我的申请需要做什么?
我的应用程序,每天为每个在小时前设置推送通知的用户发送。推送通知始终相同。
谁能帮帮我?我该怎么做?
Link 参考设置本地通知:
http://www.appcoda.com/ios-programming-local-notification-tutorial/
http://www.icodeblog.com/2010/07/29/iphone-programming-tutorial-local-notifications/
//在第一个link的代码
中替换Appdelegate.m中的以下方法
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
//-- Set Notification
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
{
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else
{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
}
// Handle launching from a notification
UILocalNotification *locationNotification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
if (locationNotification) {
// Set icon badge number to zero
application.applicationIconBadgeNumber = 0;
}
return YES;
}
您可以为本地通知执行此操作
NSDate *date = self.datePicker.date;
UILocalNotification *note = [[UILocalNotification alloc] init];
note.alertBody = @"Say Hello!";
note.fireDate = date;
[[UIApplication sharedApplication] scheduleLocalNotification:note];
您还可以使用 parse.com 中的框架进行远程通知
我是新 IOS 开发人员,我以前从未使用过推送通知或本地。
用户需要设置一个小时,以获取推送通知。 我的申请需要做什么?
我的应用程序,每天为每个在小时前设置推送通知的用户发送。推送通知始终相同。
谁能帮帮我?我该怎么做?
Link 参考设置本地通知:
http://www.appcoda.com/ios-programming-local-notification-tutorial/
http://www.icodeblog.com/2010/07/29/iphone-programming-tutorial-local-notifications/
//在第一个link的代码
中替换Appdelegate.m中的以下方法- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
//-- Set Notification
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
{
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else
{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
}
// Handle launching from a notification
UILocalNotification *locationNotification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
if (locationNotification) {
// Set icon badge number to zero
application.applicationIconBadgeNumber = 0;
}
return YES;
}
您可以为本地通知执行此操作
NSDate *date = self.datePicker.date;
UILocalNotification *note = [[UILocalNotification alloc] init];
note.alertBody = @"Say Hello!";
note.fireDate = date;
[[UIApplication sharedApplication] scheduleLocalNotification:note];
您还可以使用 parse.com 中的框架进行远程通知