At some point every Cocoa and Cocoa Touch developer has to learn how to manage memory while programming with Objective-C.  Unfortunately, it can be a confusing topic if you’re inexperienced or new to the language and frameworks. After doing my own bit of ramp-up in this area a while ago, I distilled everything I learned into three “brain triggers,” or rules, that I can use to easily remember when and how to use -retain, -release, and -autorelease (the three main methods for managing memory in Objective-C). While somewhat similar to the “memory rules” presented in Apple’s 40-page Memory Management Programming Guide for Cocoa, I’ve found my own “brain triggers” to be easier to remember, and the accompanying notes easier to reference.  To that end, I decided to share the information here in case it’s helpful to anyone else. [click to continue…]

I recently stumbled onto a collection of very cool, open-source APIs for OS X and the iPhone that some Google developers work on in their spare time. I’ve already mentioned Update Engine and Google Toolbox for Mac, so I thought it might be worthwhile to summarize the whole collection, too.

From the Google Mac Developer Playground homepage:

Tools & Demos

Quick Search Box Quick Search Box New!
An experimental, open source search box that allows you to search data on your computer and across the web.
Earth Surfer Earth Surfer New!
Connect your Mac to a Nintendo Wii Balance Board to travel over Google Earth.
Calaboration Calaboration
Easily set up iCal to synchronize with Google Calender.
Vocito Vocito
Quick and easy GrandCentral access from your Desktop.
Update Engine Update Engine
A flexible Mac OS X framework that can help developers keep their products up-to-date.
Top Draw Top Draw
Generate images using JavaScript.
Google Toolbox for Mac Google Toolbox for Mac
A collection of source and tools that may be of use to Mac and iPhone developers.
Precipitate Precipitate
Search your Google Docs and Bookmarks from Spotlight or Google Desktop.
Vidnik Vidnik
Record video segments using your iSight camera and upload them to YouTube.
Visigami Visigami
An image search application and screen-saver that uses Google Images, Picasa, and Flickr.
AppMenuBoy AppMenuBoy
Creates a hierarchical menu in the dock of all your applications.
CoverStory CoverStory
A nice user interface for analyzing code coverage (gcov) files on the Mac.
GData GData
Write Objective-C applications that talk to Google’s services through GData APIs.
Statz Statz
Update your status across multiple IM and chat networks.
MacFUSE MacFUSE
A mechanism that makes it possible to implement a fully functional file system in a user-space program on Mac OS X.
Quartz Composer Patches Quartz Composer Patches
A collection of Quartz Composer patches for Leopard that work with the ambient light and motion sensors.

The preferred image file format used by iPhone applications is PNG, so most apps come bundled with a few *.png files. When a developer builds an iPhone application, a tool called “pngcrush” is used to compress these images; this makes the application smaller and quicker (the rationale being: you can load small files into memory faster than large ones).

By default, only the iPhone OS can display images that have been compressed with pngcrush; OS X, for example, doesn’t know how to read them. This can be a problem if you’re reverse-engineering an existing iPhone app and you want to study its images.

The solution is to use a handy utiltity created by David Watanabe, called iPhonePNG. It’s a simple command-line program you use to convert “pngcrushed” PNG files to “regular” PNG files. Very handy.

Icon: Google SyncSo, some big news yesterday for iPhone owners who use Google’s suite of free mail/calendar/address book apps! Until now, it’s only been possible to have your Google Calendar and Contacts synced with your iPhone by doing a sync with iTunes (i.e., via a cable). Now that Google is exposing all its services via Microsoft Exchange ActiveSync, it can all be done via cellular connection, including “push” email. Very cool.

See Google’s instructions for how to set this up on your iPhone (note the warning about existing contacts/calendar data being deleted before the sync happens).

Google Toolbox for Mac

February 9, 2009

Icon: Google Toolbox for MacA while back I mentioned Update Engine, an open-source API offered by Google for adding “Check for updates” functionality to your OS X apps. Along those lines, some folks might be interested in Google Toolbox for Mac, which they describe as “a collection of source from different Google projects that may be of use to developers working other Mac projects.” It’s chock-full of goodies; highlights include the following:

  • Spotlight Importers, which allow you to use Spotlight (the built-in searching tool in OS X) to index and search through all your nerdy code stuff (source code–including AppleScript files, Xcode projects and metadata, the contents of Interface Builder .xib and .nib files, etc.).
  • iPhoneUnitTesting, which you can use to, um, unit test your iPhone apps.