Rajneesh071
Rajneesh071

Reputation: 31091

Will NSNotificationCreation impact on application performance?

In my code i have a lot of NSNotification around 200+ .

[[NSNotificationCenter defaultCenter] addObserver....];
[[NSNotificationCenter defaultCenter] postNotificationName...];  

Will this impact on my application performance if I register and fire notification a lot?

Upvotes: 1

Views: 162

Answers (2)

tagyro
tagyro

Reputation: 1679

Instead of NSNotificationCenter you should have a look at tolo

The biggest advantage is that you don't have to care about adding/removing observers - tolo does this for you automagically.

ps. failing to remove any observer might lead to retain cycles and memory leaks

Upvotes: 0

Sumit Mundra
Sumit Mundra

Reputation: 3901

This is depend on how to handle NSNotificationCenter in your code.if you handle your NSNotification purely then its effect bcoz its called twice or more times..

best approach for NSNotification is you add in your viewWillAppear and remove it on viewWillDisappear.

Upvotes: 2

Related Questions