Reputation: 1944
I'm new IOS developer, and i never worked before with push notification or local.
The user need to set a hour, for taken the push notification. What need to do my application?
My application, sent everyday for every user who set before the hour a push notification. The push notification is always same.
Can anyone help me? How can i do that?
Upvotes: 1
Views: 417
Reputation: 195
Link for refrence to set local notification :
http://www.appcoda.com/ios-programming-local-notification-tutorial/
http://www.icodeblog.com/2010/07/29/iphone-programming-tutorial-local-notifications/
//Replace following method in Appdelegate.m in First link's code
- (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;
}
Upvotes: 2
Reputation: 14329
You can do this for local notification
NSDate *date = self.datePicker.date;
UILocalNotification *note = [[UILocalNotification alloc] init];
note.alertBody = @"Say Hello!";
note.fireDate = date;
[[UIApplication sharedApplication] scheduleLocalNotification:note];
Also you can use framework from parse.com for remote notifications
Upvotes: 0