我是新的IOS开发人员,之前从未使用推送通知或本地工作。
用户需要设置一小时,以获取推送通知。 我的申请需要做什么?
我的应用程序,每天发送给每个在小时前设置推送通知的用户。推送通知始终相同。
任何人都可以帮助我吗?我怎么能这样做?
答案 0 :(得分:2)
参考链接以设置本地通知:
http://www.appcoda.com/ios-programming-local-notification-tutorial/
http://www.icodeblog.com/2010/07/29/iphone-programming-tutorial-local-notifications/
//在第一个链接的代码
中替换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;
}
答案 1 :(得分:0)
您可以执行本地通知
NSDate *date = self.datePicker.date;
UILocalNotification *note = [[UILocalNotification alloc] init];
note.alertBody = @"Say Hello!";
note.fireDate = date;
[[UIApplication sharedApplication] scheduleLocalNotification:note];
您也可以使用parse.com中的框架进行远程通知