Questions tagged [uilocalnotification]

Local notifications and push notifications are both ways for an iOS application that isn’t running in the foreground to let its users know it has something for them.

2291 questions
129
votes
10 answers

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

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…
pkamb
  • 26,648
  • 20
  • 124
  • 157
115
votes
5 answers

Ask for User Permission to Receive UILocalNotifications in iOS 8

I have set up local notifications in the App Delegate Using this: - (void)applicationDidEnterBackground:(UIApplication *)application { UILocalNotification *notification = [[UILocalNotification alloc]init]; [notification setAlertBody:@"Watch…
dannysandler
  • 1,851
  • 4
  • 13
  • 14
92
votes
13 answers

Delete a particular local notification

I am developing an iPhone alarm app based on local notifications. On deleting an alarm, the related local notification should get cancelled. But how can I determine exactly which object from the array of local notifications is to be cancelled? I am…
Yogi
  • 3,528
  • 3
  • 32
  • 51
47
votes
4 answers

Getting local notifications to show while app is in foreground Swift 3

Apparently this is now possible with ios10 : optional func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler:…
user6820041
  • 1,135
  • 2
  • 10
  • 25
46
votes
4 answers

UILocalNotification is deprecated in iOS 10

It may be a question in advance but I wonder what to use instead of UILocalNotification in iOS 10. I am working on an app which has deployment target iOS 8 so will it be ok to use UILocalNotification?
Roohul
  • 878
  • 1
  • 13
  • 24
43
votes
8 answers

Test if app did become active from a UILocalNotification

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…
wh1t3cat1k
  • 3,051
  • 6
  • 29
  • 36
41
votes
11 answers

detect "Allow Notifications" is on/off for iOS8

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…
JosephT
  • 765
  • 1
  • 10
  • 20
40
votes
8 answers

Find list of Local Notification the app has already set

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…
Recycled Steel
  • 2,204
  • 3
  • 27
  • 35
37
votes
6 answers

Set default iOS local notification style for application

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…
DarkDust
  • 85,893
  • 19
  • 180
  • 214
33
votes
7 answers

Using @available with stored properties

I have an app that uses local notifications and supports iOS 10. I am trying to add iOS 9 support which requires me to use the old location notification API. I am trying to use @available and #available on my iOS 10 code and I can't figure out how…
chickenparm
  • 1,230
  • 1
  • 14
  • 29
32
votes
4 answers

Triggering a specific action when the app enters foreground from a local notification in iOS? (using swift)

I am building an iOS app using the new language Swift. Now it is an HTML5 app, that displays HTML content using the UIWebView. The app has local notifications, and what i want to do is trigger a specific javascript method in the UIWebView when the…
cptdanko
  • 694
  • 2
  • 12
  • 22
31
votes
5 answers

How to delete all local notifications when an application is deleted from an iPhone

Let's say I set 5 local notification for an iPhone application, then the user deletes the app. If the app is installed again, it shows the previous notifications. I know the following code deletes all notifications [[UIApplication sharedApplication]…
Nimit Parekh
  • 16,021
  • 8
  • 47
  • 70
30
votes
3 answers

Determining if UILocalNotification fired with app in foreground or background

When receiving a UILocalNotification The method application:DidReceiveLocalNotification is called when the app is in Foreground. When the app is in the Background, it opens the application and then calls application:DidReceiveLocalNotification.…
Mark Andrews
  • 311
  • 1
  • 3
  • 5
29
votes
10 answers

iPhone: Incrementing the application badge through a local notification

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:…
Stefan
  • 28,004
  • 14
  • 62
  • 76
29
votes
5 answers

Launch a local notification at a specific time in iOS

I am trying to create a timer which triggers a local notification to go off at a time that the user has set. The issue I am having is that I cannot figure out a way to be able to set the local notification to go off at say 7:00PM. Almost all the…
imjonu
  • 367
  • 1
  • 5
  • 12
1
2 3
99 100