Joined May 2011

Jeff Remer

Software Engineer at Strava
Software Engineer
San Francisco, CA

Posted to Auto-Increment Xcode Build over 1 year ago

Clever, but Apple provides a tool expressly for this purpose, agvtool - the Apple-generic versioning tool.

Given that your project as a CFBundleVersion and CFBundleShortVersionString set in the Info.plist for each of your targets, you just need to switch the Versioning System to Apple Generic under the build settings. I recommend setting this at the project level and let your targets inherit it.

From then on you can use agvtool bump to bump the build number by one. Easy, and no mucking around with the PList yourself (though I suspect that agvtool is just basically doing what you suggest under the covers).

Posted to Your own Objective-C shared object over 1 year ago

This creates a shared instance of an object. Not a singleton. Anyone could come along and instantiate a different instance of your class using using [[YourClass alloc] init]. In order to make it a true singleton you need to ensure that +sharedObject is the only way of getting an instance.

You can run into trouble if YourClass conforms to NSCopying, in which case you can get a different object just by copying your shared instance. Not to mention that if someone explicitly releases your shared instance it will disappear forever.

Instead of:

sharedObject = [[self alloc] init];

You should have:

sharedObject = [[super allocWithZone:NULL] init];

Then override allocWithZone: to return and retain the shared instance (unless using ARC). copyWithZone: should just return self.

If manually managing memory override retain and autorelease to return self, retainCount to return NSUIntegerMax, and release as a no-op.

Posted to Remove remote merged branches over 1 year ago

The sed expression should probably not be global, it breaks for branch names with slashes in them.

sed -e 's/\// :/'

314 Karma
14,742 Total ProTip Views