iphone - NSNotification Strangeness when used in conjunction with AsyncSocket -


I'm using Asyncusk to connect to a server from my iPhone app. From the rep who receives the data from the server, I will post a notification that will tell the representative of the table view to trigger a reloaded data on the table view:

  - (zero) onset (AsyncSocket *) Sock DidReadData: (Ansdita *) data Sathtag: (long) tag {[NSNotificationCenter defaultCenter] postNotificationName: @ "PEERSTATUSCHANGED" object: self]; [ReadDataDataData: [Asyncset CRLFDA] with timeout: -1 Tags: 0]; }  

and viewController:

  - (id) initWithNibName: (NSString *) nibNameOrNil Bundle: (NSBundle *) nibBundleOrNil {if (self = [ Super initWithNibName: nibNameOrNil Bundle: nibBundleOrNil]) {[NSNotificationCenter default Center] AddObserver: self selector: @selector (peerStatusDidChange :) name: @ "PEERSTATUSCHANGED" object: nil]; } Healthy return; } - (Zero) PeerStatceded Change: (NSOtification *) Notification {NSLog (@ "Notification Receipt"); }  

Now, it does not work at all. Notification is not recognized by ViewController, however, when I do the same thing in Adaptive Launching:

  - (zero) ApplicationDeffish: Launching: (UIAPCirmation *) application {protocol = [ [Xbbprotocol illusion] init]; SourceListViewController * sourceListVC = [[[SourceListViewController alloc] initWithNibName: @ "SourceListViewController" bundle: nil] Otoriaj]; UINavigationController * Navigation Controller = [[[UINavigationController alloc] initWithRootViewController: sourceListVC] AutoCare]; [[NSNotificationCenter defaultCenter] postNotificationName: @ "PARSTATKNAGED" Object: Self]; [Protocol Connectto Server]; // Override Point for optimization after application launch [Window Adsview: [Navigation Controller view]]; [Window-making and knowledgeable]; }  

The controller I got to see the notification

Why does anyone know? Is there something to do with the representative methods of the Asyncset that occur in different threads?

Thanks in advance.

One possibility is that your initWithNibName: bundle: method is not actually Calling if you instantiate the scene controller in the NIB (rather than the code), then calls it instead of initWithCoder: .

A quick way to check is InitWithNibName: bundle: .


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -