Skip to content

{ Monthly Archives } February 2012

Why we don’t trust -retainCount

I’m pretty sure @bbum must have worn through a few keyboards telling users of StackOverflow not to rely on the value of an Objective-C object’s -retainCount. Why? When we create an object, it has a retain count of 1, right? Retains (and, for immutable objects, copies) bump that up, releases (and, some time later, autoreleases) […]

Synthesized ivars are private

Perhaps this isn’t news. Perhaps it doesn’t matter because you’ve provided public accessors. But here are the results anyway. #import <Foundation/Foundation.h> @interface A: NSObject @property (nonatomic, assign) int a; @end @interface B: A – (int)differentGetter; @end @interface C: NSObject @property (nonatomic, retain) A *anA; – (int)aFromA; @end int main(int argc, char *argv[]) { @autoreleasepool { […]

Is it an anti-pattern to use properties everywhere?

I’ve seen questions about whether to always provide accessors for ivars, and recommendations, such as in akosma software’s ObjC code standards, that say Whenever possible, do not specify ivars in the header file; use only @property and @synthesize statements instead. This isn’t how I work, which led me to ask the question: is this a […]

Some LightReading about mobile app security

[This article was co-written with @securityninja] If mobile app security is failing, it’s up to the security industry, not developers, to repair it. An article published yesterday at security news site DarkReading announces “Developers not applying secure development life cycle practices in mobile app production”. The author finds many faults with the way application security […]

Building an object-oriented dispatch system in Objective-C

iTunes was messing about rebuilding the device I was trying to use for development, so I had time over lunch to write a new message dispatch system in the Objective-C language. “But wait,” you say, “Objective-C already has a message dispatch system!” True, and it’s better than the one I’ve created. But it doesn’t use […]

On privacy, hashing, and your customers

I’ve talked before about not being a dick when it comes to dealing with private data and personally-identifying information. It seems events have conspired to make it worth diving into some more detail. Only collect data you need to collect (and have asked for) There’s plenty of information on the iPhone ripe for the taking, […]

On home truths in iOS TDD

The first readers of Test-Driven iOS Development (currently available in Rough Cuts form on Safari Books Online: if you want to buy a paper/kindle/iBooks editions, you’ll have to wait until it enters full production in a month or so) are giving positive feedback on the book’s content, which is gratifying. Bar last minute corrections and […]