uilocalnotification

Is there a simple way to edit / modify a UILocalNotification

假如想象 提交于 2019-11-27 14:41:23
Is there an easier way to edit, for example, the alertBody property of an already scheduled UILocalNotification ? For now, I just cancel the notification and schedule a new one but when the app needs to do this for 3 or more notifications, it takes long time to execute... If the documentation is correct, you can't alter an already scheduled notification. The doc states for -scheduleLocalNotification: : […] Because the operating system copies notification, you may release it once you have scheduled it. The notification object is copied by the system and not accessible via any (public) method.

How to set repeat frequency in User Notification [duplicate]

≯℡__Kan透↙ 提交于 2019-11-27 14:05:52
问题 This question already has answers here : How do I set an NSCalendarUnitMinute repeatInterval on iOS 10 UserNotifications? (3 answers) Closed 2 years ago . Till iOS 9 we write local notifications like this UILocalNotification* localNotification = [[UILocalNotification alloc] init]; localNotification.fireDate = pickerDate; localNotification.alertBody = self.textField.text; localNotification.timeZone = [NSTimeZone defaultTimeZone]; localNotification.repeatInterval = NSCalendarUnitMinute;

Custom repeat interval for UILocalNotification

余生长醉 提交于 2019-11-27 12:57:07
I tried the Re.minder app and noticed that it can repeat reminders with custom intervals (such as every 3 minutes, every 2 hours, every 4 days,...). How can I do that? Jeremy Handel Thanks for trying our app! It turns out, we're not actually using UILocalNotification repeatInterval to accomplish that. Given it's limitations (only one NSCalendarUnit), we actually wrote our own scheduler. This has it's own limitations, mainly the 64 local notification queue limit per app. We essentially schedule and build our own queue, then fill the local notifications from that. Any time the user launches or

How do I create and cancel unique UILocalNotification from a custom class?

廉价感情. 提交于 2019-11-27 11:21:08
问题 Currently I have a timer with an alarm (local notification). I want to create a timer class from this code to create multiple timers and notifications (at most 5) and I am struggling with how to create and cancel unique notifications with a class method. - (UILocalNotification *) startAlarm { [self cancelAlarm]; //clear any previous alarms alarm = [[UILocalNotification alloc] init]; alarm.alertBody = @"alert msg" alarm.fireDate = [NSDate dateWithTimeInterval: alarmDuration sinceDate:

Alternative to UserNotificationCenterDelegate's willPresent when app is in background

南楼画角 提交于 2019-11-27 09:37:20
I am trying to figure out whether I can accomplish my goal through Local Notifications, or whether I need to switch to Remote Notifications. I'm practicing iOS 10 / Swift 3 by building an alarm program that plays the latest episode of a RSS-updated radio show at a set time of day. When the app is in the foreground, this is easy to execute through UNUserNotificationCenterDelegate's willPresent function. I just use willPresent to fetch the latest episode, and play it through an AVAudio Player. Of course, if the app only works in the foreground, this functionality is very limited. I would want

Fire local notification every day on different times

三世轮回 提交于 2019-11-27 07:43:31
I'm developing a project that notifies the user every day on a different time from a pre-defined database, five times a day to be precise. My problem is how schedule all these times, 5times*365days = 1825 fire dates !! is it possible to schedule them all? any ideas would be very much appreciated According to Apple documentation: An application can have only a limited number of scheduled notifications; the system keeps the soonest firing 64 notifications (with automatically rescheduled notifications counting as a single notification) and discards the rest I solved that problem by setting a

Find list of Local Notification the app has already set

匆匆过客 提交于 2019-11-27 07:25:53
My app allows users to set a number of reminders in the future. When the app lauches I want to know what reminders (notifications) have already been set. Can I read back the notifications I have set or do I need to store in my app (e.g. Core Data or Plist)? UIApplication has a property called scheduledLocalNotifications which you can use. Frizzo For Swift 3.0 and Swift 4.0 don't forget to do import UserNotifications This is working for iOS10+ and watchOS3+ since the class UNUserNotificationCenter is not available for older versions ( link ) let center = UNUserNotificationCenter.current()

detect “Allow Notifications” is on/off for iOS8

老子叫甜甜 提交于 2019-11-27 07:24:05
I am trying to detect the Local notification settings for the App in iOS 8 for UIUserNotificationSettings , it returns me 7 as I have turned on all Badge, Sound & Alert. In the setting, I switch off "Allow Notification" , the app still return me 7 for UIUserNotificationSettings (Badge, Sound & Alert on). Is there a way to detect "Allow Notification " on/off? - (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings{ NSLog(@"---notificationSettings.types %d" , notificationSettings.types ); if(notificationSettings

Repeating local notification daily at a set time with swift

给你一囗甜甜゛ 提交于 2019-11-27 07:19:37
I am new to iOS development, but have created the app and I am trying to create a daily notification for a set time. Currently the notification executes once for the given date/time. I am unsure how to use the repeatInterval method to schedule it daily. What is the best method to repeat the notification daily ? any help would be much appreciated (Y). var dateComp:NSDateComponents = NSDateComponents() dateComp.year = 2015; dateComp.month = 06; dateComp.day = 03; dateComp.hour = 12; dateComp.minute = 55; dateComp.timeZone = NSTimeZone.systemTimeZone() var calender:NSCalendar = NSCalendar

Swift - AVAudioPlayer, sound doesn't play correctly

萝らか妹 提交于 2019-11-27 07:17:26
问题 Because UILocalNotification is not being displayed while the application is in active stat, I'm trying to configure an UIAlertController and playing a little sound when it appears. I've no problem, in the AppDelegate , to handle the notification/create the alert. My problem concerns the sound. Indeed, it doesn't play correctly. Here is what I have so far : //... class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(application: UIApplication,