Guest User

Untitled

a guest
Jun 21st, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. - (void)dealloc {
  2. // Generic dealloc method for all subclasses
  3. unsigned int c;
  4. objc_property_t *properties = class_copyPropertyList([self class], &c);
  5. for(int i = 0; i < c; i++){
  6. objc_property_t property = properties[i];
  7. NSString *propertyAttributes = [NSString stringWithUTF8String: property_getAttributes(property)];
  8. NSRange range = NSMakeRange(1, [propertyAttributes rangeOfString:@","].location - 1);
  9.  
  10. NSLog(@"Range: %@", NSStringFromRange(range));
  11. NSString *encodeString = [propertyAttributes substringWithRange:range];
  12.  
  13. NSLog(@"Encode string: %@", encodeString);
  14.  
  15. if ([encodeString hasPrefix:@"@"]) {
  16. [self setValue:nil forKey:[NSString stringWithUTF8String:property_getName(property)]];
  17. }
  18. }
  19.  
  20. free(properties);
  21. [super dealloc];
  22. }
Add Comment
Please, Sign In to add comment