The documentation http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSNotificationCenter_Class/Reference/Reference.html talks of the sender and notification name but where does it mention whom to post this notification to?
NSnotificationCenter postNotificationName who is the receiver?
2.3k Views Asked by Namratha At
2
There are 2 best solutions below
2
ohho
On
notification is a broadcasting mechanism. As from the doc, "Objects register with a notification center to receive notifications (NSNotification objects) using the addObserver:selector:name:object: or addObserverForName:object:queue:usingBlock: methods." i.e., any object interested can register as a listener.
Related Questions in IOS
- Overlapping UICollectionView in storyboard
- Cannot pod spec lint because of undeclared type errors
- Is the transactionReceipt data present in dataWithContentsOfURL?
- UIWebView Screen Fitting Issue
- ZXingObjC encoding issues
- iOS: None of the valid provisioning profiles allowed the specific entitlements
- How to hide "Now playing url" in control center
- CloudKit: Preventing Duplicate Records
- Slow performance on ipad erasing image
- Swift code with multiple NSDateFormatter - optimization
- iOS 8.3 Safari crashes on input type=file
- TTTTimeIntervalFormatter always returns strings in English
- How do I add multiple in app purchases in Swift Spritekit?
- Setup code for xibs in iOS. -awakFromNb:
- iOS Voice Over only reads out the title of any alert views
Related Questions in NOTIFICATIONS
- Display both alertTitle and AlertBody on a custom WatchKit notification
- App crash (if closed) after click on notification
- Design pattern for corner-case logic without switch and conditional statements
- How display notification on IOS 8 like in google maps in navigation time
- Phonegap notification.alert works only in Android
- Allow user to select notification sound in iOS Notification Settings
- Send a Android BLE GATT Notification
- How to remove notifications when touched?
- Change text of a TextView using a notification action without opening the app
- ViewController deinit after performing segue using Notification
- Using AS3 Timer & distriqt Notification ANE To Send Notifications While In Sleep Mode
- How to show notification in android with arabic text?
- Notification not appearing Notification Tray
- how to notify a user when a new sql record inserted?
- Should I catch Exception, Throwable or other in EventDispatcher/Observable
Related Questions in NSNOTIFICATIONCENTER
- ViewController deinit after performing segue using Notification
- What is the proper use of NSNotificationCenter with ReactiveCocoa 3 and Swift?
- Why @selector can call a method which is declared in an implementation file?
- What is a "non-weak zeroing reference"
- On button action NSNotificationCenter Rises again the keyboard
- Dispatch group and NSNotification
- Issue while calling NSNotificationCenter
- How can I execute a method when the volume button is pressed?
- addObserver/removeObserver in viewWillAppear/viewWillDisappear
- Alternative to getting payload out of notification when user doesn't directly tap the notification?
- Disabling a uibutton in parentview controller after an action performed in its child view
- How do I know if an object can be weakly referenced?
- Having trouble converting an Obj-C observer to Swift syntax
- Is good to call selector method ViewWillAppear in NSNotificationCenter
- Swift2 iOS Reachability Class and NSNotificatonCenter not receiving broadcast
Related Questions in RECEIVER
- Receiver doesn't work after restart
- Android RAM usage error with broadcast receiver in service
- android.intent.action.BATTERY_OKAY is not working in broadcast receiver, what to do in broadcast receiver?
- IOexception was unhandled through Arduino
- Pass the greater of two entered numbers from one app and have a receiver broadcast it in another
- Receiving connection change on Android with a huge delay
- Receiver not registered from DialogFragment
- how to get both sim serial number below lollipop 5.0
- How to verify if the phone is docked?
- Generate a WLAN signal in Matlab
- NSnotificationCenter postNotificationName who is the receiver?
- Cannot have more than one INSTALL_REFFERER receiver in Android Manifest
- expected primary-expression before 'switch'
- How to use Android AlarmManager in Fragment in Kotlin?
- Attaching multiple interrupts to single ISR function in Arduino ESP8266
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You don't post a notification directly to someone. The name of the notification, and sender determine who gets the notification.
Interested objects can subscribe to a notification. When you post a notification, all subscribers who are listening to a notification by that name will get notified. Actually Cocoa notifications can be tweaked at two levels:
The class documentation illustrates this clearly.
Here's a little ASCII table from the docs showing who gets notified depending on what notification name and sender were used when created:
Unspecified means a nil value was supplied for that field.
Notifications allows for a loosely coupled design as objects are not tied together in their implementations and can work independently off each other.