#pingpong @ Redwind Software

By: Conor 26. August 2014 17:45
Sure isn't everyone mad for the timelapses these days...

 

Every day from 18:00 - 18:30 we'll record the most amazing display of table tennis skills this side of the Liffey. Or any side of the Liffey really.

 

 

Powered by the awesome folks at @evrcm & AsTimeGoesBy

TAGS:

NSObject has some "new" properties in iOS 8

By: Conor 20. August 2014 11:38
I can't take the credit for finding this, that belongs to @booranger, but he's fierce blog-shy so I'll post it 😃

 

While updating some existing apps to ensure they run all lovely on iOS 8 we happened across a nice infinite recursion issue in some of our internal library code.

 

Recursion

 

dictionary, description, dictionary, description, dictionary, description, dictionary, description, dictionary, description, dictionary, description, dictionary, description, dictionary, description, ASPLODE, KABOOM, CRASH!!!!

 

Bit of background…

RWSSerializationObject is a parent class that most of our model classes inherit from. It has some convenient stuff on it like being able to create and save itself to and from NSDictionary/JSON/SQLite and so on. One of the tricks it uses is Objective-C's runtime ability to inspect classes with class_copyPropertyList. In a nutshell, we recursively traverse the property tree of an object until we reach the top. Encounter something easy like a string, number, etc and we just store it a key/value pair. Encounter something more complex like another RWSSerializationObject and we perform the same trick on it. Result is we end up with the complete model in an NSDictionary.

 

New properties

Logging out the properties on our object produced different results on iOS 7 and iOS 8.

 

Properties iOS 7 Properties iOS 8

 

Straight away we can see that there are more properties on iOS 8 for some reason. But what are they…

 

hash
superclass
description
debugDescription

 

But those aren't properties you scream, we all scream… They are methods… everyone knows that. So why are they appearing as properties all of a sudden.

 

The big reveal

In iOS 8 they've been promoted/demoted to methods…

 

IOS 7 IOS 8

 

Conclusion

If you are using class_copyPropertyList you may want to check that your app doesn't blow up on iOS 8 because of these "new" properties.

 

TAGS:


History