uilocalnotification

Test if app did become active from a UILocalNotification

我是研究僧i 提交于 2019-11-26 18:52:41
问题 Is there a way to know if the application did become active from a local notification? I know there is a way to test if the application was launched from a local notification alert; but if it just was sitting out there the background, and received a notification? I need to run different code, when the app has become active: From a local notification. Just has become active :) Is there a way to do it? 回答1: I'm afraid Sylter is incorrect. When an app enters the foreground from the background ,

iPhone: Incrementing the application badge through a local notification

ぐ巨炮叔叔 提交于 2019-11-26 18:32:14
is it possible to increment the application badge through a local notification while the app is not running? I know how to set the badge, but haven't found any way to increment this value. localNotification.applicationIconBadgeNumber = 23; Update: I found a (far from being perfect) solution. You can predict what will happen, if the user doesn't open the app and add notifications for every +1 event. An example: For day 1: Count = 0 For day 2: localNotification.applicationIconBadgeNumber = 1; For day 3: localNotification.applicationIconBadgeNumber = 2; For day 4: localNotification

Is there a simple way to edit / modify a UILocalNotification

北城以北 提交于 2019-11-26 18:26:34
问题 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... 回答1: 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

Repeating local notification daily at a set time with swift

只愿长相守 提交于 2019-11-26 17:38:24
问题 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

Alternative to UserNotificationCenterDelegate's willPresent when app is in background

走远了吗. 提交于 2019-11-26 14:49:16
问题 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.

Displaying a stock iOS notification banner when your app is open and in the foreground?

痞子三分冷 提交于 2019-11-26 14:09:42
When Apple's official iOS Messages app is open and in the foreground, new messages from other contacts trigger a stock, native iOS notification alert banner. See image below. Is this possible in 3rd party apps on the App Store? Local and/or Push Notifications for your app while your app is open and in the foreground ? When testing my app , notifications are received but no iOS alert UI is shown . But this behavior is seen in Apple's official Messages app: The Local and Remote Notification Programming Guide says: When the operating system delivers a local notification or remote notification and

Fire local notification every day on different times

荒凉一梦 提交于 2019-11-26 13:50:12
问题 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 回答1: 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

detect “Allow Notifications” is on/off for iOS8

僤鯓⒐⒋嵵緔 提交于 2019-11-26 13:09:37
问题 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 *

Local notification on application termination

▼魔方 西西 提交于 2019-11-26 12:47:15
问题 I am working on an application which will not work if terminated. It has some background tasks. I want to show a local notification if the app is terminated. There are applications which do this which means this is doable. But I am not able to find out a way. I have tried to set up a local notification in applicationWillTerminate: method of appdelegate as well as added a notification of app termination in my viewcontroller but none of the methods get called when app is actually terminated. -

iPhone : Daily local notifications

左心房为你撑大大i 提交于 2019-11-26 09:35:42
问题 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 回答1: You