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
5
votes
1 answer

Stopping notification bar to popup during game play

Context: I am working on a windows phone game using XNA 4.0 framework. During the gameplay, if the user accidentally drags the top of screen, notification center gets dragged down. I have seen few apps where this behaviour is overridden and instead…
monish001
  • 671
  • 2
  • 8
  • 20
4
votes
1 answer

Why calling cancelAllLocalNotifications removes/clears Notification Center?

Using cancelAllLocalNotifications should basically cancel the delivery of all scheduled local notifications. But it goes ahead and clear the history as well, and as a result the Notification Center doesn't show the last 1/5/10 recent…
Mustafa
  • 20,504
  • 42
  • 146
  • 209
4
votes
2 answers

NotificationCenter observer is “mutated after capture by sendable closure”

Consider this simple class: import Foundation class ExampleClass { init() { let notificationCenter = NotificationCenter.default var observer: NSObjectProtocol? = nil // A warning is emitted for the next line …
bdesham
  • 15,430
  • 13
  • 79
  • 123
4
votes
0 answers

Is it possible to maintain playback in AudioKit after a route change?

Is it possible to continue playing sound after a route change (such as switching speakers or plugging in/unplugging headphones) without reloading the sample again in Sampler? This is the only approach I have found that works: @objc dynamic…
4
votes
1 answer

How to detect when user changes Spaces on macOS?

I'm trying to get an macOS application to detect when the user switches Spaces. Mostly following this suggestion (Detecting when a space changes in Spaces in Mac OS X) though updated to import Cocoa @NSApplicationMain class AppDelegate: NSObject,…
parker9
  • 141
  • 1
  • 4
4
votes
2 answers

Type 'UIApplication' has no member 'didBecomeActiveNotification'

I'm trying to add observer for UIApplication.didBecomeActiveNotification with following code: NotificationCenter.default.addObserver(forName: UIApplication.didBecomeActiveNotification, object: nil, queue: nil) { _ in /* some code */ } but Xcode…
Alexander Vasenin
  • 11,437
  • 4
  • 42
  • 70
4
votes
3 answers

How to get the screen height after orientation change?

I'm getting some strange results when querying UIScreen.main.bounds.height after an orientation change. Maybe this isn't the correct way to do it. I have an observer that listens for the NSNotification.Name.UIDeviceOrientationDidChange…
Turnip
  • 35,836
  • 15
  • 89
  • 111
4
votes
0 answers

iOS 11 Widget does not expand when "Show more" button is tapped

The problem is the widget does not expand when "Show more" button is tapped. Based on several users, the problem is intermittently happing since iOS11 update. On the same device it would work, then later for some reason it would not work. Also, we…
Naz
  • 215
  • 3
  • 12
4
votes
1 answer

Passing parameters with #selector

I'm a beginner to Swift and I'm trying to initiate a function through NotificationCenter. The observer in 'ViewController.swift' calls on function reload: override func viewDidLoad() { super.viewDidLoad() …
nomadoda
  • 4,561
  • 3
  • 30
  • 45
4
votes
1 answer

How to set NotificationCenter's observer when selector is a static method

func addObserver(_ observer: Any, selector aSelector: Selector, name aName: NSNotification.Name?, object anObject: Any?) This function needs the observer to be some object but while setting static methods as the selector. This answer explains how…
4
votes
0 answers

iOS 10 - When/how to set the UNUserNotificationCenterDelegate?

I'm updating my app to the new Local Notification framework. Everything works great, as long as I set the notification delegate in the application's didFinishLaunchingWithOptions (notifs are scheduled and fired, and the delegate's willPresent and…
Spiffre
  • 63
  • 3
4
votes
0 answers

Swift 3 - Saving text when a user touches outside of a UITextField

In Swift 3, I need to detect if the user touches outside of a UITextField, then check that a particular UITextField is the sender, and then save the text. I have been trying to do this with Notification Center I have found examples in Swift 2, but…
4
votes
1 answer

Why name of today widget in OSX is always "Widget"?

I am learning today-extension widget programming for OSX (not iOS currently). And I am trying to develop a calendar widget as a practice. But the title or the name of the widget in notification center is always "Widget" instead of what I set. I…
4
votes
0 answers

Custom default notification center settings for app

Is it possible to have custom default notification center settings for my iOS app? The idea is that I want to allow push notifications, but do not wish to have the notifications display on the lock screen by default. All other settings are fine as…
DemonGyro
  • 483
  • 3
  • 11
4
votes
0 answers

EKReminder: Reminder with alarm not appearing in NotificationCenter

I tried to add an alarm (EKAlarm) to a reminder (EKReminder). Almost everything works fine: The reminder is added in the "Reminders.app" and gets fired at the right time. But somehow (in contrast to a manually created reminder) the firing date/time…
Luca
  • 163
  • 1
  • 5
1
2
3
16 17