https://github.com/zekunyan/ttgnotificationguard
Auto remove the observer from NSNotificationCenter after the oberser dealloc
https://github.com/zekunyan/ttgnotificationguard
guard ios notification objective-c
Last synced: 18 days ago
JSON representation
Auto remove the observer from NSNotificationCenter after the oberser dealloc
- Host: GitHub
- URL: https://github.com/zekunyan/ttgnotificationguard
- Owner: zekunyan
- License: mit
- Created: 2016-07-17T13:54:35.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-07-20T15:56:30.000Z (almost 9 years ago)
- Last Synced: 2025-04-29T23:17:32.484Z (about 1 month ago)
- Topics: guard, ios, notification, objective-c
- Language: Shell
- Size: 37.1 KB
- Stars: 13
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TTGNotificationGuard
[](https://travis-ci.org/zekunyan/TTGNotificationGuard)
[](http://cocoapods.org/pods/TTGNotificationGuard)
[](http://cocoapods.org/pods/TTGNotificationGuard)
[](http://cocoapods.org/pods/TTGNotificationGuard)## What
Auto remove the observer from NSNotificationCenter after the oberser dealloc, base on [TTGDeallocTaskHelper](https://github.com/zekunyan/TTGDeallocTaskHelper).## Requirements
iOS 6 and later.## Installation
TTGNotificationGuard is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:```ruby
pod "TTGNotificationGuard"
```## Usage
1. TTGNotificationGuard is default off, so you must turn it on first.
```
#import "NSNotificationCenter+TTGNotificationGuard.h"- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Enable the TTGNotificationGuard
[NSNotificationCenter ttg_setTTGNotificationGuardEnable:YES];
return YES;
}
```2. No more need to do. Just start coding as usual :)
## Example
To run the example project, clone the repo, and run `pod install` from the Example directory first.
## Author
zekunyan, [email protected]
## License
TTGNotificationGuard is available under the MIT license. See the LICENSE file for more info.