Questions tagged [notificationcenter]

Notification Center is an interface designed by Apple that allows users to easily view notifications from all applications in one view. Notification Center is available in iOS 5 and up.

Notification Center is an interface designed by Apple that allows users to easily view notifications from all applications in one view. Notification Center is activated by dragging down from the devices status bar (top of screen), and removed similarly by dragging up from the bottom of the screen.

Options for Notification Center include:

  • Weather widget (powered by Yahoo)
  • Stocks widget (powered by Yahoo)
  • Sort by time
  • Sort manually (allows users to manually arrange the order in which notifications will appear from top to bottom)
  • Ability to enable/disable notifications for individual applications

Notification Center is available in iOS 5 and up.

242 questions
92
votes
4 answers

NotificationCenter issue on Swift 3

I'm learning Swift 3 and I'm trying to using NSNotificationCenter. Here is my code: func savePost(){ let postData = NSKeyedArchiver.archivedData(withRootObject: _loadedpost) UserDefaults.standard().object(forKey: KEY_POST) } func…
RoccoBerry
  • 951
  • 1
  • 7
  • 10
57
votes
5 answers

Type 'Notification.Name' (aka 'NSNotification.Name') has no member 'UIApplication'

First it said that 'UIApplicationDidEnterBackground' has been renamed to 'UIApplication.didEnterBackgroundNotification' and when I dot it,it said Type 'Notification.Name' (aka 'NSNotification.Name') has no member 'UIApplication' func…
mathias merlot
  • 585
  • 1
  • 4
  • 4
30
votes
2 answers

Fit width in iOS 8 Today Extensions

When I make any iOS 8 Today Extension, there is an empty space on the left of approximately 48px, even if in Interface Builder I place a label on the left side at x=0. I have seen that some apps, however, use a full-width widget. How can I…
Antonio Giarrusso
  • 810
  • 1
  • 9
  • 19
17
votes
1 answer

How to display an image from Asset Catalog in Today Extension?

I'm working on a Today Extension for iOS8. My App Group is set up correctly and I can successfully use NSUserDefaults to send simple bits of data to my extension (using this tutorial). In the storyboard for my extension, I've placed an image onto…
Andrew Davis
  • 2,310
  • 1
  • 24
  • 43
15
votes
1 answer

Removing a notification from notification center on click

Is it possible to remove the push notification from the notification center when one is clicked and the app launches? Most apps seem to leave the notification in place. I read on another question that this: [[UIApplication sharedApplication]…
15
votes
2 answers

SwiftUI with NotificationCenter publishers

I want to listen to notifications when the app goes to the background and comes back. I'm trying to use the NotificationCenter publishers and have the SwiftUI view listen to them. I can use a few methods to do it and I'm trying to use two of them…
hastoro11
  • 203
  • 1
  • 2
  • 5
15
votes
4 answers

How to programmatically read incoming text messages on iOS

There have been tons of questions on how to programmatically access the SMS messages stored in the iPhone. Doing a small research you will quickly and sadly find out that Apple won't let us developers touch the SMS API or SMS database due to obvious…
Fabio Moggi
  • 405
  • 1
  • 4
  • 12
14
votes
3 answers

In what situation would one use expectationForNotification in swift testing

I'm a little confused as what/when to do with expectationForNotification as opposed toexpectationWithDescription`. I've been unable to find any clear examples in swift for when and what you do with this call. I'm assuming its perhaps to test…
Jeef
  • 26,861
  • 21
  • 78
  • 156
10
votes
1 answer

NotificationCenter Crash in Swift 3

Is it just me, or did NotificationCenter become a hot mess in Swift 3? :) I have the following setup: // Yonder.swift extension Notification.Name { static let preferenceNotification = Notification.Name("preferencesChanged") } // I fire the…
9
votes
3 answers

Dragging Gestures in iOS 8 Today Extensions

I'm using a UIView subclass in my Today widget. The view makes use of swiping gestures. However, these gestures either scroll the whole Notification Center up and down, or make the Notification Center switch from Today to Notifications. Is there any…
Raffael
  • 1,119
  • 10
  • 20
6
votes
0 answers

How to detect when the control/notification center appears?

In my iOS app I want to know when the control or the notification center appears. Is there a notification specifically for this available? The notifications for applicationWillResignActive and applicationDidBecomeActive do not help in my situation…
6
votes
2 answers

Notification center - notification not appearing in notification center when they received on active app

I need that all notification will apear in notification center , and in my app only the notification received from background or when app is closed is presented in notification center. Is that my problem ? How to add a notification to notification…
5
votes
0 answers

Toggling DoNotDisturb with code in macOS Big Sur

In earlier versions of macOS you could toggle DoNotDisturb by modifying the properties file for NotificationCenter. On the Big Sur beta however that's not the case anymore. The new ControlCenter does not seem to write to any property file when you…
Mellson
  • 2,918
  • 1
  • 21
  • 23
5
votes
1 answer

NotificationCenter migrating swift 3 to swift 4.2 problem

I am having trouble trying to migrate my piece of code from Swift 3 to Swift 4.2 here is the current code to be migrated: fileprivate func observeKeyboardNotifications() { NotificationCenter.default.addObserver(self, selector:…
CVar
  • 103
  • 1
  • 9
5
votes
5 answers

How to handle multiple remote-notification click in IOS

I am trying to open different view controllers based on notification click but when push notification is received it automatically runs the controller code in background so when I open the app through app icon/notification from notification centre…
moDev
  • 5,248
  • 4
  • 33
  • 63
1
2 3
16 17