nsnotificationcenter Questions

7

A UIViewController adds itself to the default center: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(editFood) name:@"editFood" object:nil]; Then a UITableView del...

3

Solved

Can I post a notification in a given queue and receive it on another? I want to use notifications to communicate different queues, but I'm not sure if this is safe...
Jasik asked 12/4, 2013 at 10:1

6

Solved

This code will call the method "defaultsChanged", when some value in UserDefaults changed NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; [center addObserver:self selector:@s...
Speedwell asked 3/6, 2012 at 16:8

44

Solved

I have an app that has a text field on the lower half of the view. This means that when I go to type in the text field the keyboard covers the textfield. How would I go about moving the view upwar...
Spermatophyte asked 27/9, 2014 at 0:53

3

like the title says, I found this unexpected behavior in iOS 11 & 12. Does anyone know why this event gets called and, more importantly, is there any workaround to prevent system from firing th...
Madelon asked 20/5, 2019 at 6:55

4

Solved

When using SwiftUI with iOS 13+, the traditional means of determining background state no longer work. For example: AppDelegate methods applicationDidEnterBackground(_ application: UIApplication) ...

17

Solved

How do you add an observer in Swift to the default notification center? I'm trying to port this line of code that sends a notification when the battery level changes. [[NSNotificationCenter defaul...
Chan asked 4/6, 2014 at 23:2

12

Solved

I'm trying to update this code to swift 3: NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("keyboardWillShow:"), name: UIKeyboardWillShowNotification, object: nil) NSNot...
Discharge asked 17/6, 2016 at 7:48

6

Solved

I am trying to observe individual NSManagedObject changes on NSManagedObjectContextWillSaveNotification: - (void)managedObjectContextWillSave:(NSNotification *)notification { for (NSManagedObject...
Gadabout asked 10/10, 2014 at 7:13

5

I am working on a test project in Swift 3. I am trying to pass textField string from one class to another class using NotificationCenter. I am trying to workout the answer from this link: pass NSSt...
Photojournalism asked 13/10, 2016 at 8:18

3

I have changed my app target to IOS 13 to check the deprecated methods in my app and I am getting below warning: 'UIApplicationDidChangeStatusBarOrientationNotification' is deprecated: first de...
Cree asked 5/7, 2019 at 9:41

7

Solved

I'm implementing socket.io in my swift ios app. Currently on several panels I'm listening to the server and wait for incoming messages. I'm doing so by calling the getChatMessage function in each...
Cense asked 28/4, 2016 at 9:47

9

Solved

In the process of porting an iPhone application over to android, I am looking for the best way to communicate within the app. Intents seem to be the way to go, is this the best (only) option? NSUse...
Djerba asked 16/10, 2010 at 4:10

6

Solved

I'm getting this error with Swift 4.2 Type 'NSNotification.Name' has no member 'keyboardDidShowNotification' Here is my code: NotificationCenter.default.addObserver(self, selector: #selector(...
Prolific asked 13/9, 2018 at 15:8

8

Solved

I have been using Keyboard notifications without any problem and getting exact height of Keyboard. - (void)keyboardDidShow:(NSNotification *) notification{ CGSize keyboardSize = [[[notification u...
Ravelment asked 15/8, 2017 at 8:59

1

Solved

I'm making an alarm clock app, and I have confirmed that my alarm notifications are being triggered correctly, but the sound does not always play as I expect. For instance, when the phone is not in...

3

Solved

When the app is in background mode or phone is in sleep state and a VoIp push is received the below function in AppDelagte directs the user (to the UserTableViewController in the app) and posts a n...
Aqueduct asked 27/9, 2017 at 10:9

11

Solved

From iOS 12 you simply use NWPathMonitor which is a line of code (example). For historic purposes: I'm trying to integrate network connectivity detection into my app, however it seems that somewhe...
Gules asked 5/12, 2014 at 6:54

10

I am trying to run a function when the keyboard shows and disappears and have the following code: let notificationCenter = NotificationCenter.default notificationCenter.addObserver(self, selector:...
Lizarraga asked 18/1, 2017 at 11:41

1

Solved

The standard way to check for a change between Dark and Light modes on iOS is with a view-level delegation function: override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollect...
Knowall asked 18/5, 2021 at 20:14

0

I found an issue, I have a project which has both Swift and objective - C files. I have added NSnotificationcenter addobserver, which works fine in debug mode, but when I generate IPA (release mode...
Comportment asked 30/4, 2021 at 5:2

8

Solved

How do I check if an UIViewController is currently being displayed? My UIViewControllers are listening for NSNotifications - even if when they are not displayed (ie not shown). So I could have 10 ...

1

Solved

Starting with ios 9 it is not necessary to unsubscribe from notification center since ios handles this automatically, but prior to ios 9 developers had to manually call NotificationCenter.default.r...
Notation asked 12/2, 2021 at 8:39

7

Solved

Is it possible to get the list of observers (objects and selectors) for a given notification name? (NSNotificationCenter)
Cleanlimbed asked 27/4, 2012 at 7:42

1

Solved

an alternative title is "Why AVSystemController_AudioVolumeNotificationParameter notification event never get triggered?" The goal is to monitor the volume change event and its value. Fol...
Dehaven asked 2/11, 2020 at 6:5

© 2022 - 2025 — McMap. All rights reserved.