Skip to content

Commit

Permalink
Update README about NSNotificationCenter deallocation
Browse files Browse the repository at this point in the history
On iOS 9 and onwards, NSNotificationCenter stores its targets weakly. Therefore it automatically removes observers on deallocation.

https://developer.apple.com/library/mac/releasenotes/Foundation/RN-Foundation/index.html#10_11NotificationCenter
  • Loading branch information
kaandedeoglu authored Sep 5, 2016
1 parent 3f95e38 commit 2092b09
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ github "uber/signals-ios" ~> 2.0

## Introduction

NSNotifications are inherently error prone. If a listener doesn’t de-register itself from a notification when it’s deallocated, firing the notification will crash the application. If you refactor the data you send with a notification, the compiler won't warn you but your app might crash at runtime.
NSNotifications are inherently error prone. Prior to iOS 9, if a listener doesn’t de-register itself from a notification when it’s deallocated, firing the notification will crash the application. If you refactor the data you send with a notification, the compiler won't warn you but your app might crash at runtime.

NSNotifications are also unnecessarily broad. Anyone can listen in on them which couples separate components in your application implicitly together.

Expand Down

0 comments on commit 2092b09

Please sign in to comment.