From 7de50f78332820d177c596948fa6134935686b85 Mon Sep 17 00:00:00 2001 From: Giuseppe Nucifora Date: Fri, 29 Jan 2016 13:34:37 +0100 Subject: [PATCH] - Fi PNObject dealloc --- Pod/Classes/PNObject.m | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Pod/Classes/PNObject.m b/Pod/Classes/PNObject.m index c392771..e7d3cab 100644 --- a/Pod/Classes/PNObject.m +++ b/Pod/Classes/PNObject.m @@ -323,9 +323,14 @@ - (void)dealloc { - unsigned int propertyCount; - objc_property_t *properties = class_copyPropertyList([self class], &propertyCount); - for(int i = 0; i < propertyCount; i++)[self removeObserver:self forKeyPath:[NSString stringWithCString:property_getName(properties[i]) encoding:NSUTF8StringEncoding]]; + + NSDictionary *properties = [PNObject propertiesForClass:self.class]; + + for (NSString *propertyName in properties) { + + [self removeObserver:self forKeyPath:propertyName]; + } + } @end