NSNotification called before view controller is initialised completely?

Thanks guys, both right! I set up the Notification in app delegate. I should put it at the end of viewDidLoad.

Then it is only called when there is a subsequent update and I don't need a flag to stop the first notification from doing an update before the object is up and running.

Up vote 1 down vote favorite share g+ share fb share tw.

Hi I have a viewcontroller in a tabview controller. I decided to use NSNotification to flag when views in the tabview controller need to update their data. Previously each had logic to tred to decided the state of the data model and update accordingly.

My update code calls some stuff that in turn call delegate methods. These were all working when not using notification. My first attempt at notifying seemed to call the selector before the view controller had initialised (before viewDidload at least).

Among other thing the delegate methods were never called when the update in the notification selector was run and the view controller didn't get updated. Seems like the viewcontroller is in some unknown state. I ran a test and put the same update code in the viewDidLoad and only called the notification code after the viewDidLoad had been called.

This works. My question is ,is there another way of preventing the notification selector method being called before viewDidLoad or the object is otherwise correctly initialised. I am using storyboard so I am not programming the creation of views etc. I hope this is clear - posting a whole bunch of code would not had been any easier.

Ios nsnotification link|improve this question asked Feb 5 at 9:55Ian61.

Then register for the NSNotification specifically for the case when the view controller is already initialized and needs to update itself. – Jack Lawrence Feb 5 at 13:35.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions