Questions tagged [nsnotificationcenter]

NSNotificationCenter allows to send and register for notifications in the Foundation framework, which is provided by Apple.

An NSNotificationCenter object (or simply, notification center) provides a mechanism for broadcasting information within a program. An NSNotificationCenter object is essentially a notification dispatch table. Notifications are differentiated according to their name and contain an object (the sender) as well as any specific data.

Objects register with a notification center to receive notifications (NSNotification objects) using the addObserver:selector:name:object: or addObserverForName:object:queue:usingBlock: methods. Each invocation of this method specifies a set of notifications. Therefore, objects may register as observers of different notification sets by calling these methods several times.

You can also post notifications with postNotification:, or create and post notifications with postNotificationName:object: and postNotificationName:object:userInfo:, where you may use custom names for your notifications.

References:

1577 questions
0
votes
1 answer

Using iOS GCD and NotificationCenter to alert user when asynch data load is complete (async load of several datasets one at a time)

I am writing an iPad App in which I load data for a multi-storied building asynchronously. I have set up NSNotifications to alert the user once data-load for all floors is complete. The data load for each floor is kicked off in a loop when a load…
0
votes
1 answer

Notified with changes of Calendar events

I want to get notified when my application is in background with : [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(calendarChanged:) name:EKEventStoreChangedNotification object:nil]; I tried to implement it but…
Alaa12
  • 47
  • 2
  • 8
0
votes
1 answer

write to database when ios app in background state

When iPhone app is in background state or when app is minimized, I want to monitor the duration of time the app is in background and on every regular interval like every 24hrs need to get updates from web server and write the modifications in my…
0
votes
1 answer

iOS 6: UserInfo returns nil for Pasteboard change Notification

Here's the Notification Observer for the Pasteboard change event, I need it to handle the copied selected text [[NSNotificationCenter defaultCenter] addObserver:self …
0
votes
1 answer

ASIHTTPRequest Issue With NSNotificationCenter

I download Images Using ASIHTTPRequest. I wrote This Code: +(void)GetImagesURL { NSLog(@"%i",[TripsArray count]); for (int i=0;i< [TripsArray count]; i++) { NSURL *DetailTripURL = [NSURL URLWithString:[[TripsArray…
0
votes
1 answer

Is there a way to recognise from which application NSNotification / NSEvent came?

I have started listening to global keyDown events. Is there a way to get information from which application that event came? A handler receives NSNotification instance and NSEvent is part of it. Can I somehow extract that information from those…
0
votes
3 answers

error after change rootviewcontroller +[NSNotificationCenter dictationViewClass]

I get the following error after I change the rootViewControler of my UIWindow. 2012-10-16 15:12:35.653 repdocApp[22898:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSNotificationCenter…
Sebastian
  • 952
  • 1
  • 14
  • 41
0
votes
1 answer

How to avoid UIAlertView duplicate show from Notfications

I have a selector to show UIAlertView asking user if want to retry upload images after NotificationCenter post a notification with observename. [[NSNotificationCenter defaultCenter] postNotificationName:kNOTIFICATION_PHOTOS_UPLOAD_RETRY…
Edward Chiang
  • 1,133
  • 2
  • 12
  • 24
0
votes
1 answer

In-app alert from list of NSDates

I pull down a list of meeting dates from a server to my app. I parse through all of them and save them as NSDates. It's easier to give a use case: User pulls down meeting dates User navigates to another section of the app If it is 15min until a…
random
  • 8,568
  • 12
  • 50
  • 85
0
votes
3 answers

NSNotificationCenter removing wrong observers?

Is there any corner case behaviors for removeObserver:name:object:? In the following block of code, my observer isn't being registered properly: - (void)setPlayerItem:(AVPlayerItem *)playerItem { [[NSNotificationCenter defaultCenter]…
wL_
  • 997
  • 8
  • 13
0
votes
2 answers

Objective-C - Callback when keyboard is off screen

I'm sliding the keyboard off screen by doing this: -(void)methodA { [textField resignFirstResponder]; } I listen to UIKeyboardDidHideNotification to be notified when the keyboard is hidden, here is the selector for the notification: -…
Peter Warbo
  • 11,136
  • 14
  • 98
  • 193
0
votes
2 answers

NSNotificationCenter and mapType

I am trying to change the mapType from another ViewController but It only displays the HybridType. Any other mapType is not changing whatever the button on my segmented control is pressed. What am I doing wrong? Thank you in advance.. -(void)…
snksnk
  • 1,566
  • 4
  • 21
  • 46
0
votes
1 answer

UIAlertView clean up for background

I read apple document about background mode And I don't understand when should I dismiss my UIAlertView. In applicationWillResignActive: notification or in applicationDidEnterBackground:? And what the difference if I dismiss UIAlertView in…
0
votes
1 answer

Register for notifications for application's viewDidAppear/etc.?

Is it possible in iOS to register on AppDelegate for notifications for all viewDidAppear which happen in this app? I want to have register for those to do some analytics processing for my app, without the need to explicitly trigger my class from…
0
votes
2 answers

What are the possibilities with sending a Notification in iOS

i want to know what the possibilities are with sending a Notification. Is it possible to send a NSUserDefaults? I know you can send another viewcontroller. Like this: NSUserDefaultsDidChangeNotification is just a notification that is sent out when…
1 2 3
99
100