{"action":"created","issue":{"url":"https://api.github.com/repos/devxoul/UITextView-Placeholder/issues/8","labels_url":"https://api.github.com/repos/devxoul/UITextView-Placeholder/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/devxoul/UITextView-Placeholder/issues/8/comments","events_url":"https://api.github.com/repos/devxoul/UITextView-Placeholder/issues/8/events","html_url":"https://github.com/devxoul/UITextView-Placeholder/issues/8","id":70077861,"number":8,"title":"willDealloc never execute","user":{"login":"culmek","id":7533318,"avatar_url":"https://avatars.githubusercontent.com/u/7533318?v=3","gravatar_id":"","url":"https://api.github.com/users/culmek","html_url":"https://github.com/culmek","followers_url":"https://api.github.com/users/culmek/followers","following_url":"https://api.github.com/users/culmek/following{/other_user}","gists_url":"https://api.github.com/users/culmek/gists{/gist_id}","starred_url":"https://api.github.com/users/culmek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/culmek/subscriptions","organizations_url":"https://api.github.com/users/culmek/orgs","repos_url":"https://api.github.com/users/culmek/repos","events_url":"https://api.github.com/users/culmek/events{/privacy}","received_events_url":"https://api.github.com/users/culmek/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/devxoul/UITextView-Placeholder/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/devxoul/UITextView-Placeholder/labels/help%20wanted","name":"help wanted","color":"159818"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-04-22T09:48:52Z","updated_at":"2015-04-23T02:35:27Z","closed_at":null,"body":"I have found an another problem,  willDealloc never execute.\r\nSo It can't  execute   [[NSNotificationCenter defaultCenter] removeObserver:self];    in  willDealloc's block method  ?\r\n\r\nWhen I remove   [[NSNotificationCenter defaultCenter] addObserver:self\r\n                                                 selector:@selector(updatePlaceholderLabel)\r\n                                                     name:UITextViewTextDidChangeNotification\r\n                                                   object:self];\r\n\r\nThe below mothod did't exec either..\r\n- (void)observeValueForKeyPath:(NSString *)keyPath\r\n                      ofObject:(id)object\r\n                        change:(NSDictionary *)change\r\n                       context:(void *)context {\r\n    [self updatePlaceholderLabel];\r\n}\r\n"},"comment":{"url":"https://api.github.com/repos/devxoul/UITextView-Placeholder/issues/comments/95397454","html_url":"https://github.com/devxoul/UITextView-Placeholder/issues/8#issuecomment-95397454","issue_url":"https://api.github.com/repos/devxoul/UITextView-Placeholder/issues/8","id":95397454,"user":{"login":"culmek","id":7533318,"avatar_url":"https://avatars.githubusercontent.com/u/7533318?v=3","gravatar_id":"","url":"https://api.github.com/users/culmek","html_url":"https://github.com/culmek","followers_url":"https://api.github.com/users/culmek/followers","following_url":"https://api.github.com/users/culmek/following{/other_user}","gists_url":"https://api.github.com/users/culmek/gists{/gist_id}","starred_url":"https://api.github.com/users/culmek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/culmek/subscriptions","organizations_url":"https://api.github.com/users/culmek/orgs","repos_url":"https://api.github.com/users/culmek/repos","events_url":"https://api.github.com/users/culmek/events{/privacy}","received_events_url":"https://api.github.com/users/culmek/received_events","type":"User","site_admin":false},"created_at":"2015-04-23T02:35:27Z","updated_at":"2015-04-23T02:35:27Z","body":"I have found some problems..\r\n\r\n// all uitextviews will be changed \"dealloc\" method to \"swizzledDealloc\", it's bad\r\n\r\n+ (void)load {\r\n    [super load];\r\n    \r\n    // is this the best solution?\r\n    method_exchangeImplementations(class_getInstanceMethod(self.class, NSSelectorFromString(@\"dealloc\")),\r\n                                   class_getInstanceMethod(self.class, @selector(swizzledDealloc)));\r\n}\r\n\r\n- (void)swizzledDealloc {\r\n    // it can be caused a dead cycle ??\r\n\r\n//    [self swizzledDealloc];\r\n    [[NSNotificationCenter defaultCenter] removeObserver:self];\r\n    // this will be crash cause some textviews didn't addObserver..\r\n    for (NSString *key in self.class.observingKeys) {\r\n        [self removeObserver:self forKeyPath:key];\r\n    }\r\n}\r\n\r\n// here is useless, cause observeValueForKeyPath.. method didn't exec\r\n        for (NSString *key in self.class.observingKeys) {\r\n            [self addObserver:self forKeyPath:key options:NSKeyValueObservingOptionNew context:nil];\r\n        }\r\n\r\n\r\nAnd I think you should use navigationcontroller to push a viewcontroller which has a uitextview(set placeholder), then override the dealloc method to see dealloc() is exec or not ??"}}