unnotificationrequest

Update UILabel text value , when changing the user permission for notification in application setting page?

一世执手 提交于 2019-12-11 06:23:46
问题 In my scenario, User will get an alert for receiving Notification in application. If the user clicks on "Don't Allow" UILabel is updated with "Not enabled". If the user wants to change the notification,User will be navigated to application setting page to change the notification permission status. func checkNotificationPermission(){ UNUserNotificationCenter.current().requestAuthorization(options:[.badge, .alert, .sound]){ (granted, error) in if granted == true { DispatchQueue.main.async {

Cancel UNNotificationRequest

ε祈祈猫儿з 提交于 2019-12-11 03:09:34
问题 Because UILocalNotification is now deprecated, I moved my code to the new UNNotificationRequest API. It states: ' cancelLocalNotification ' was deprecated in iOS 10.0: Use UserNotifications Framework's -[UNUserNotificationCenter removePendingNotificationRequestsWithIdentifiers:] But it seems that it is not equal - while I could remove messages with cancelLocalNotification at any time (even they are displayed/delivered) it seems that removePendingNotificationRequestsWithIdentifiers only

Trigger UILocalNotification for every 14 days (fortnightly) Swift

雨燕双飞 提交于 2019-12-08 03:17:15
问题 The question has been already answered on SO. Here is the reference: iOS Notification Trigger: fortnightly and/or quarterly But what I have tried is so far: var fortnightPart1 = DateComponents() fortnightPart1.weekday = Calendar.current.component(.day, from: Sdate) //(Day..here Sunday) fortnightPart1.weekdayOrdinal = 2 //= n == (nth Day in the month...here 2nd Sunday in every month month) fortnightPart1.hour = Calendar.current.component(.hour, from: Sdate) fortnightPart1.minute = Calendar

Trigger UILocalNotification for every 14 days (fortnightly) Swift

寵の児 提交于 2019-12-07 20:13:19
The question has been already answered on SO. Here is the reference: iOS Notification Trigger: fortnightly and/or quarterly But what I have tried is so far: var fortnightPart1 = DateComponents() fortnightPart1.weekday = Calendar.current.component(.day, from: Sdate) //(Day..here Sunday) fortnightPart1.weekdayOrdinal = 2 //= n == (nth Day in the month...here 2nd Sunday in every month month) fortnightPart1.hour = Calendar.current.component(.hour, from: Sdate) fortnightPart1.minute = Calendar.current.component(.minute, from: Sdate) fortnightPart1.second = Calendar.current.component(.second, from:

ios 10 swift 3 add more than 64 local notifications does not keep soonest

青春壹個敷衍的年華 提交于 2019-12-06 00:14:07
As we know limit of local notifications in ios 10 equals to 64. However app like water reminder requires a lot of notification per day and user can choose unique plan for each of the day. The problem is: lets say I have already stored 64 notifications (10 for monday, 8 for tuesday and etc., they are all scheduled as repeated weekly) <UNCalendarNotificationTrigger: 0x6000008292e0; dateComponents: <NSDateComponents: 0x600000352fe0> Hour: 1 Minute: 3 Second: 0 Weekday: 6, repeats: YES> (lldb) po trigger.nextTriggerDate() ▿ Optional<Date> ▿ some : 2017-06-01 22:03:00 +0000 -

How do I check my applicationIconBadgeNumber value?

给你一囗甜甜゛ 提交于 2019-12-02 06:58:13
I want my redDot to display when I have some value in badge, i.e UIApplication.shared.applicationIconBadgeNumber this is the code I wrote, but doesnt seem to work : import UserNotifications @IBOutlet weak var redDot: UIImageView! override func viewDidLoad() { super.viewDidLoad() runCheck() } func runCheck(){ if (UIApplication.shared.applicationIconBadgeNumber>=1) { self.redDot.alpha=1 } else { self.redDot.alpha=0 } } Based on our conversation in chat about this, you have three things you need to happen: You set up a notification to fire later with a badge number. But the notification will not

UNNotification: Custom Sound for LocalNotification is not playing in iOS10

ぐ巨炮叔叔 提交于 2019-12-02 02:59:09
I am firing the Local Notification. Since UILocalNotification class is deprecated in iOS10 I have used UserNotifications.framework When i try to set the custom sound for notification, the default sound is playing all time. here is my code: - (IBAction)fireLocalNotification:(id)sender { UNMutableNotificationContent* content = [[UNMutableNotificationContent alloc] init]; content.title = [NSString localizedUserNotificationStringForKey:@"Hello!" arguments:nil]; content.body = [NSString localizedUserNotificationStringForKey:@"Hello_message_body" arguments:nil]; content.sound = [UNNotificationSound

Local Notifications make sound but do not display (Swift)

痞子三分冷 提交于 2019-12-01 08:14:19
I am trying to create a local notification for my app using Apple's UNUserNotificationCenter. Here is my code: let center = UNUserNotificationCenter.current() let content = UNMutableNotificationContent() content.title = task.name content.body = task.notes content.sound = UNNotificationSound.default() let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false) let request = UNNotificationRequest(identifier: task.UUID, content: content, trigger: trigger) center.add(request) { (error:Error?) in if let theError = error { print("Notification scheduling error: \(error)") }else{

Local Notifications make sound but do not display (Swift)

ⅰ亾dé卋堺 提交于 2019-12-01 04:44:25
问题 I am trying to create a local notification for my app using Apple's UNUserNotificationCenter. Here is my code: let center = UNUserNotificationCenter.current() let content = UNMutableNotificationContent() content.title = task.name content.body = task.notes content.sound = UNNotificationSound.default() let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false) let request = UNNotificationRequest(identifier: task.UUID, content: content, trigger: trigger) center.add(request)

Limit for Local Notifications (UNNotificationRequest) in iOS 10

三世轮回 提交于 2019-12-01 03:53:39
I know that the limit of local notifications is 64 for UILocalNotification . It's written in Apple Dev Docs . But UILocalNotification is deprecated in iOS 10. Instead this one, Apple proposes to use UNNotificationRequest . But Apple Dev Docs doesn't say anything about limiting the count of notifications. I found this answer , but it doesn't have links to Apple Dev Docs or something like that (it's just an opinion). Does anyone know for sure about restrictions of local notifications? Maybe someone know the link to Dev Docs or is there an official response from Apple about this? Although it's