Questions tagged [nsnotification]

NSNotification is a class used to send messages to observing classes through NSNotificationCenter.

NSNotification is a class used to send messages to observing classes through NSNotificationCenter. Notifications must have a name and can be optionally associated with a specific object. If an object is provided, the notification is only delivered to a class that is also observing the exact same name and object.

To send a notification, use NSNotificationCenter's postNotification: (a convenience function postNotificationName:object:userInfo: also exists which creates a notification and posts it with a single call). Classes posting a notification can also include an optional userInfo parameter to pass an object to the receiving class.

For more information, see Apple's documentation for NSNotification and NSNotificationCenter.

312 questions
0
votes
1 answer

NSNotification delay from class A to class B

My NSNotification is delayed. In myVC, I have two buttons, buttonA and buttonB. Each one is linked to their respective pdfs, pdfA and pdfB. There is a button Push, which is pressed after A or B is pressed. Push brings the user to the RVC where…
0
votes
0 answers

postNotificationName exc bad access

I'm receiving a lot of crash log for postNotificationName: What I'm doing is that I register for notification on viewdidappear and removeObserver on viewdiddisappear. Most of them are crashing just after sendDelegateAnimationDidStop, what calls…
user774150
  • 962
  • 2
  • 10
  • 24
0
votes
1 answer

reload tableView in last method run

I have method that get notification as I download one image. I can download a lot of objects and I want to update tableView then I have last notification of downloaded image. How the best way to accomplish it? -…
0
votes
1 answer

ALAssetLibrary Notification and enumerateAssetsUsingBlock

I'm building an iOS app that allows a user to take a picture and save it to a custom album, which populates a UICollectionView in the app with the photos from the album. I found plenty of examples on the web on how to do this, but I could NOT get…
0
votes
2 answers

NSNotificationCenter to post a C structure and retrieve it back from the notification callback function

I have a complex C structure and it's hard to convert this structure to NSDictionary one by one. How do I post this C structure via NSNotificationCenter and retrieve it back from the NSNotificationCenter callback function? Any suggestion will be…
0
votes
2 answers

Fetch request returns old data

I'm getting outdated results when executing a fetch request upon a NSManagedObjectContextObjectsDidChangeNotification. As an example, consider directories with documents that can be deleted logically with a boolean attribute (softDeleted). The…
hpique
  • 119,096
  • 131
  • 338
  • 476
0
votes
2 answers

NSTableViewDelegate receiving multiple NSNotifications

I have a view-based NSTableView whose data is supplied by a subclass of NSArrayController. The array controller also receives NSNotifications (just 2) from other objects telling it to update. As long as the array controller is not acting as a…
Joel
  • 44
  • 3
0
votes
1 answer

Child UITableViewController can't receive notification from Parent UITableViewController?

As the question states, I am sending a notification to a child TVC and that child TVC is unable to receive the notification and excute the selector handleNotification: (NSNotification *) paramNotif. I.e. I do not get the NSLog output from that…
Cescy
  • 1,921
  • 3
  • 18
  • 21
0
votes
2 answers

Why using NSNotification argument

Here is the code in main.m [[NSNotificationCenter defaultCenter]addObserver:logger selector:@selector(zoneChange:) name:NSSystemTimeZoneDidChangeNotification object:nil]; here is the code in .h file -(void)zoneChange:(NSNotification *)note; Can…
user3090658
  • 157
  • 2
  • 9
0
votes
1 answer

How to document NSNotifications properly with headerdoc?

The documentation for UIApplication contains a section Notification where all related NSNotifications are listed. Unfortunately, the header files available in Xcode don't contain the corresponding comments. The HeaderDoc User Guide shows how the…
Etan
  • 17,014
  • 17
  • 89
  • 148
0
votes
2 answers

Call method in other viewcontroller by notification when view appears

I have two ViewControllers. Let's call them aVC and bVC. In aVC, I show an alertView. If you press a Button on that alertView, a segue is performed to bVC. In bVC, something should happen when the view appears but only when triggered from that…
irie
  • 189
  • 1
  • 9
0
votes
1 answer

Dispatch table for NSNotifications cleared for no reason.

I am dispatching notification from my facade class which hides the complexity of the model from my viewcontrollers. Now, I have a simple tab barcontroller with a navigation controller on the first tab. So far so good, a very typical design. Now…
Earl Grey
  • 7,426
  • 6
  • 39
  • 59
0
votes
0 answers

Class initialitation, notifications

I have classes: loginViewController, helloViewController, howAreYouViewController. I also have a class ActionsViewController. The first 3 classes are initialized when it is appropriative. I want to call some methods from ActionsViewController (but…
0
votes
2 answers

UIWebView/MPMoviePlayerController and the "Done" button

I am using the UIWebView to load both streaming audio and video. I have properly set up the UIWebView delegate and I am receiving webViewDidStartLoading and webViewFinishedLoading events perfectly. The webview launches a full screen window (likely a…
David Sowsy
  • 1,680
  • 14
  • 13
0
votes
1 answer

iOS is there a better alternative to notification-based code?

I'm in process of implementing "new game" functionality for one of my apps and ran into an issue where occasionally my code crashes because a notification is sent to a deallocated object. There are just a couple places where the notifications are…
Alex Stone
  • 46,408
  • 55
  • 231
  • 407