uilocalnotification

Local Notification in background

会有一股神秘感。 提交于 2019-11-27 01:45:58
问题 Can anyone please tell me how to get a UILocalNotification while my app is in the background. I am posting my code here. Thanks in advance. UILocalNotification *localNotif = [[UILocalNotification alloc] init]; if (localNotif == nil) return; localNotif.fireDate =[startDate addTimeInterval:60]; NSLog(@"%@",localNotif.fireDate); localNotif.timeZone = [NSTimeZone defaultTimeZone]; localNotif.alertAction = @"View"; localNotif.soundName = UILocalNotificationDefaultSoundName; NSString *notifStr=

Schedule number of Local Notifications

瘦欲@ 提交于 2019-11-27 01:28:29
问题 I am making an iPhone application in which I have implemented the concept of local notification to alert the user for taking medicine. But in iOS we can't schedule more than 64 notifications at a time. But I have a number of date-time entries in the database. How could I schedule more than 64 notifications? 回答1: I've created app with local notifications and in this case user was notified every 20/40/60 minutes in given time interval (eg. 8:00-20:00). The solution was to generate up to 64

iPhone : Daily local notifications

99封情书 提交于 2019-11-27 01:13:43
I am trying to implement local notification This is what I have set // Current date NSDate *date = [NSDate date]; // Add one minute to the current time NSDate *dateToFire = [date dateByAddingTimeInterval:20]; // Set the fire date/time [localNotification setFireDate:dateToFire]; [localNotification setTimeZone:[NSTimeZone defaultTimeZone]]; Instead of 20, I want to put a fixed time(daily)to start push. For ex:I want to push notification pop up at every 6:00AM. How can do that ? Thanks You just need to properly create a NSDate object to be your fire date (time). Instead of using [NSDate

Alarm clock app in iOS

六眼飞鱼酱① 提交于 2019-11-27 00:23:15
问题 I have to create an alarm clock app for the iPhone in which user can set alarm time and sound. In doing so, I have used UILocalNotification to set off the alarm. Now, in UILocalNotification, first we get Notification Alert with option "Close" and "View". If the user taps on "View", then my delegate receives the application:didReceiveLocalNotification: message and the alarm sound plays. But in the system-native alarm app, we don't see a notification alert; it just directly plays the alarm

How can I schedule local notification for the following scenario?

狂风中的少年 提交于 2019-11-26 22:47:48
问题 Experts, I have a scenario wherein I need to notify user three times a day (morning, afternoon, evening). And the timings for these notifications will be different for each day, based on database values for each date. These three notifications are configurable. Meaning user might just choose to set afternoon and evening while turning off morning notification under settings. As per my understanding I can achieve this using local notifications. I can do the following: - before the application

Add Local Notification in iOS 10 - Swift 3

北战南征 提交于 2019-11-26 22:32:12
So I been trying to add a notification to the new UNUserNotificationCenter, but I don't seem to get it. My view controller has an action: @IBAction func sendPressed(_ sender: AnyObject) { let content = UNMutableNotificationContent() content.title = "Hello" content.body = "What up?" content.sound = UNNotificationSound.default() // Deliver the notification in five seconds. let trigger = UNTimeIntervalNotificationTrigger.init(timeInterval: 5, repeats: false) let request = UNNotificationRequest.init(identifier: "FiveSecond", content: content, trigger: trigger) // Schedule the notification. let

Set default iOS local notification style for application

匆匆过客 提交于 2019-11-26 22:12:56
Starting with iOS 5, there are two notification styles: banner and alert (the "old" style). A user can set which style to use for each application in the settings. However, the default now seems to be that notifications are displayed banner style. I'm using local notifications for reminders about events that will happen "now". A banner disappears shortly after it appeared (and it's not obvious enough that one can tap it), so for these notifications it would be desirable to have the alert style notifications as those stay on screen until the user decided on an action (ignore or go to app). Is

UILocalNotification is deprecated in iOS10

我的未来我决定 提交于 2019-11-26 21:41:04
It may be a question in advance but I wonder what to use instead of UILocalNotification in iOS10. I am working on an app which has deployment target iOS8 so will it be ok to use UILocalNotification ? ElonChan Yes, you can use UILocalNotification , old APIs also works fine with iOS10, but we had better use the APIs in the User Notifications framework instead. There are also some new features, you can only use with iOS10 User Notifications framework. This also happens to Remote Notification, for more information: Here . New Features: Now you can either present alert, sound or increase badge

How to grab the NEXT fire date from a UILocalNotification object

ぐ巨炮叔叔 提交于 2019-11-26 21:25:48
问题 I have a UILocalNotification object that I have setup with repeat intervals day, week, and month. I am having no troubles at all accessing the fire date of the object: [cell.detailTextLabel setText:[notification1.fireDate description]]; But I am having troubles getting the next fire date. If I print out the above notification1 object to the console, I get this: <UIConcreteLocalNotification: 0x613e060>{fire date = 2010-11-29 03:53:52 GMT, time zone = America/Denver (MST) offset -25200, repeat

Local and Push Notifications in IOS version compatible

主宰稳场 提交于 2019-11-26 19:15:38
问题 I developed local Notifications in iOS 10 . It is working perfectly. But now how should i code local notifications and push notification if user is using iOS 9 and above versions. Can anyone help please? Below is code in iOS 10 import UIKit import UserNotifications @available(iOS 10.0, *) class ViewController: UIViewController,UNUserNotificationCenterDelegate { override func viewDidLoad() { super.viewDidLoad() if #available(iOS 10.0, *) { //Seeking permission of the user to display app