Ios 预谋通知
是否可以设置应用程序在指定时间从其自身发送通知?也许是让他们排队?到目前为止,我必须通过推送通知服务器,而当我每周二早上发送消息时,这似乎是过火了。还有,这叫什么(这样我可以在网上更好地研究它)您可以这样安排通知:Ios 预谋通知,ios,notificationcenter,Ios,Notificationcenter,是否可以设置应用程序在指定时间从其自身发送通知?也许是让他们排队?到目前为止,我必须通过推送通知服务器,而当我每周二早上发送消息时,这似乎是过火了。还有,这叫什么(这样我可以在网上更好地研究它)您可以这样安排通知: - (void)scheduleNotification { //Cancel all previous Local Notifications [[UIApplication sharedApplication] cancelAllLocalNotification
- (void)scheduleNotification
{
//Cancel all previous Local Notifications
[[UIApplication sharedApplication] cancelAllLocalNotifications];
//Set new Local Notifications
Class cls = NSClassFromString(@"UILocalNotification");
if (cls != nil)
{
UILocalNotification *notif = [[cls alloc] init];
//3 days
notif.fireDate = [NSDate dateWithTimeInterval:60.0f*60.0f*24.0f*3.0f sinceDate:[NSDate date]];
notif.timeZone = [NSTimeZone defaultTimeZone];
notif.alertBody = @"Come Back Again! Lets blast All Zombie!";
notif.alertAction = @"PLAY";
notif.soundName = UILocalNotificationDefaultSoundName;
notif.applicationIconBadgeNumber = 1;
[[UIApplication sharedApplication] scheduleLocalNotification:notif];
}
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[application registerForRemoteNotificationTypes:
UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeAlert |
UIRemoteNotificationTypeSound];
[self scheduleNotification];
..
}
UILocalNotification应该是一个开始!所以你想让你的应用程序在每周二早上8点弹出一条消息?当用户不在应用程序中时,是否必须弹出此对话框?