Tag: uilocalnotification

知道iOS通知是否被解雇

有什么方法可以知道本地通知是否被通知中心拒绝(例如通过按下xbutton)? 是否有可能获得通知中心当前可见的所有通知的列表?

计划的本地通知未被存储在scheduledLocalNotification数组中

如果用户当天还没有打开应用程序,我目前正在安排本地通知在每天下午6点出现一次。 如果用户已经加载了应用程序,那么我想取消当天的通知,并在明天下午6点安排一个新的通知。 但是,当我尝试迭代预定的通知列表(这不是应用程序中唯一的本地通知)时,通知显示正常,[[UIApplication sharedApplication] scheduledLocalNotifications]数组始终为空。 下面是给我麻烦的代码片段: // See if we need to create a local notification to tell the user that they can receive a daily reward NSArray *notifications = [[UIApplication sharedApplication] scheduledLocalNotifications]; // <- This is always empty // Iterate over all the pending notifications for( int iter = 0; iter < [notifications count]; […]

我可以发送没有声音的本地通知吗?

我想有几个本地的通知没有显示,没有声音,但只有一个振动。 我可以通过设置alertBody到@""来让它不做任何显示,但是我怎样才能发出声音呢? 我在想,如果我没有从你们那里得到更好的办法,那么我将能够发出一个空的声音,将它添加到我的项目中,然后将soundName设置为该声音。 但有没有什么默认的方式来做到这一点? 如果我添加一个虚假的声音名称,它仍然播放默认的通知声音。 谢谢!!

closures已经交付的UILocalNotification?

是否有可能做到这一点? UIApplication's scheduledLocalNotifications UIApplication's通知似乎不会返回已经传递给用户通知中心的通知,所以我认为这可能是devise上的,但是我找不到任何有关这方面的文件证据。 有人知道吗? 谢谢! 编辑:find这个: 您可以通过在应用程序对象上调用cancelLocalNotification来取消特定的预定通知,并且可以通过调用cancelAllLocalNotifications来取消所有预定的通知。 这两种方法都是以编程方式解除当前 这里: http : //developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/IPhoneOSClientImp/IPhoneOSClientImp.html 但是,如果scheduledLocalNotifications未给我已经交付的通知,那么如何获得已交付通知的引用? 编辑2: 我注册了一些通知之后,我正在试图做的是: UIApplication *app = [UIApplication sharedApplication]; for (UILocalNotification *localNotification in app.scheduledLocalNotifications) { if (someCondition) { [app cancelLocalNotification:localNotification]; } } } 问题是,一旦他们交付,他们不再处于“scheduledLocalNotifications”。

每日本地通知在Swift iOS 9.2中

试图迅速发送每日本地通知。 但是由于某种原因,它只是每分钟发送一次。 我希望在应用程序打开后的第一个通知发送30分钟,然后每天重复此通知。 在迅速fie我有以下代码: // ———每日通知代码(也在应用程序delagate中添加部分———- let theDate = NSDate() let dateComp = NSDateComponents() dateComp.minute = 30 let cal = NSCalendar.currentCalendar() let fireDate:NSDate = cal.dateByAddingComponents(dateComp , toDate: theDate, options: NSCalendarOptions(rawValue: 0))! let notification:UILocalNotification = UILocalNotification() //choosing what it says in the notification and when it fires notification.alertBody = "Your Daily Motivation is Awaits" notification.fireDate = […]

现在显示的UIlocalNotification没有启动后台任务

我有一个voip应用程序。 我在我的应用程序中使用UILocalNotification来警告在后台应用程序中传入呼叫的​​通知。 当应用程序在后台时,获得来电后将调用以下function。 -(void)showLocalNotification:(NSNotification *)notification { NSDictionary *dic = notification.userInfo; NSString *msg = [dic objectForKey:@"msg"]; NSString *sound = [dic objectForKey:@"sound"]; [[UIApplication sharedApplication] cancelAllLocalNotifications]; UILocalNotification *_localNotification = [[UILocalNotification alloc]init]; //setting the fire dat of the local notification _localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:1]; //setting the time zone _localNotification.timeZone = [NSTimeZone defaultTimeZone]; //setting the message to display _localNotification.alertBody = […]

每30秒UILocalNotification

我试图设置一个UILocalNotification使用以下逻辑每30秒运行一次,但它似乎是行为不端。 有两个问题: 当通知被解雇的时候,似乎有很多都是一次性的,而不是每30秒一次。 应用程序图标的徽章号码似乎并没有增加。 它只停留在1。 请有人帮我弄清楚我做错了什么吗? // Create 'base' notification we can use UILocalNotification *baseNotification = [[UILocalNotification alloc] init]; baseNotification.timeZone = [NSTimeZone defaultTimeZone]; baseNotification.repeatInterval = NSMinuteCalendarUnit; baseNotification.alertBody = @"My Message."; baseNotification.alertAction = @"My Alert Action"; baseNotification.soundName = UILocalNotificationDefaultSoundName; UILocalNotification *alertOne = [baseNotification copy]; alertOne.applicationIconBadgeNumber++; alertOne.fireDate = [[NSDate date] dateByAddingTimeInterval:30]; [[UIApplication sharedApplication] scheduleLocalNotification:alertOne]; UILocalNotification *alertTwo = […]

每天下午5点重复UILocalNotification

如何每天下午5点重复UILocalNotification? 以下是我的代码来设置自定义时间。 但我想每天通知用户在自定义或可能是静态的时间。 我正在使用iOS 6。 -(void)scheduleNotification{ NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"h:mm a"]; NSDate *dateFromString = [[NSDate alloc] init]; dateFromString = [dateFormatter dateFromString:timeStr]; UILocalNotification *localNotif = [[UILocalNotification alloc] init]; if (localNotif == nil) return; localNotif.fireDate = dateFromString; localNotif.repeatInterval = kCFCalendarUnitDay; localNotif.timeZone = [NSTimeZone defaultTimeZone]; // Notification details localNotif.alertBody = @"Reminder is set"; // […]

在一周中的某几天重复UILocalNotification

我想定制一个UILocalNotification的重复间隔在一周的某些天。 我还没有find任何有关这方面的信息。 如何在一周中的某些特定date中设置通知的重复时间间隔,例如,星期日,星期一和星期五重复通知?

iOS中的UILocalNotification中不显示动作和类别

我有我从苹果文档这里相信以下是我需要有一个UILocalNotification的类别: – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { UIMutableUserNotificationAction *acceptAction = [[UIMutableUserNotificationAction alloc] init]; // Define an ID string to be passed back to your app when you handle the action acceptAction.identifier = @"ACCEPT_IDENTIFIER"; // Localized string displayed in the action button acceptAction.title = @"Accept"; // If you need to show UI, choose foreground acceptAction.activationMode = […]