Xcode user defaults allows some good stuff!

Thanks to @ddribin for the reminder that Xcode user defaults contains some good stuff.

Apple documentation is here.

Here are the settings I just set different from the defaults (yah, I know, I like lots of space):

defaults write com.apple.Xcode XCCodeSenseFormattingOptions -dict InExpressionsSpacing " " InFunctionArgsSpacing " " InMessageSpacing " " PostColonSpacing " " MessageArgSpacing " " BlockSeparator "\n"

Not sure that’s all how I want it yet, but hopefully that’ll fix a few things I dislike (like when I select something in the help text and it’s pasted in all cramped with no white space.

Unfortunately, MessageArgSpacing doesn’t seem to be working… in Xcode v3.1.4 anyway… ūüė¶

Reminder that the application shouldn’t be running when you’re editing user defaults.

Startup-weekend comes back to Portland

March 5 through 7, 2010  Startup-weekend will be happening in Portland at NEDspace.  Looks like a fun weekend.

I love this entry on their registration page:

“Close your eyes and press “9” a lot!” ¬†– very funny!

Anyway, looks like a good event. ¬†Dad might go; not sure Geek has the attention span necessary… though he is going to spend a weekend playing chess on the school JV team at the state chess tournament… ¬†Have to ask him and see what he thinks.

iPad design

Geek & Dad have a coveted early-access developer iPad? How in the world did we get on that list?!

Geek & Dad only has one small app in the AppStore! Maybe Apple’s trying to motivate young programmers for that’s where they see the innovation coming from? Astounding!

Ah, not quite ūüôā :

Reality: after reading a tweet by @ravenme, dad decided to make an iPad prototype to get a sense of how users will interact with the device. Definitely helps to get a feel for it! However, the pictures above before dad realized it needs to weigh more. ¬† Matte board and cardboard make for a very light iPad! ¬†Dad quickly realized that he was holding it in portrait mode with one hand in a manner that was not something users were going to be doing (at least not for long. ¬†Adding weight is clearly needed. That’s next.

Fun experiment.

Launch Services Database; 64 bit vs 32 bit on 10.5.x

Some notes on using lsregister to modify the launch services database to get the Finder to acknowledge changes you’ve made to your info.plist. Also sample info.plist entries to get your app to launch in 32 bit mode in 10.5.8 and 64 bit mode in 10.6.

Dad was working on a Mac Application and put in the entries in the info.plist so that the application would launch as 32bit in 10.5.x and 64 bit in 10.6 and later. ¬†Unfortunately, it wasn’t doing the right thing and it took some detective work to track it down.

Turns out this application was using a slightly modified version of Chris Campbell’s SystemVersionCheck shim and it launches the real executable via execv which seems to ignore LSMinimumSystemVersionByArchitecture and code>LSArchitecturePriority and always seems to launch the first architecture in the application executable (not 100% sure on what rules it uses to decide).

What works without the system check launch thing is this:

  <key>LSArchitecturePriority</key>
  <array>
    <string>x86_64</string>
    <string>i386</string>
    <string>ppc</string>
    <string>ppc64</string>
  </array>
  <key>LSMinimumSystemVersionByArchitecture</key>
  <dict>
    <key>x86_64</key>
    <string>10.6</string>
  </dict>

While trying to track this down I ended up wanting to purge the entries in the Launch Services database. The lsregister tool is used to do this, and there is an applescript out there that’ll do it with a GUI and force a complete rebuild. If you want a more surgical approach, you can use commands like:

./lsregister -dump > ~/Desktop/ls_dump

to get a dump of the launch services database to figure out what’s going on. Note that ./lsregister -h provides helpful information.

I ended up using the ./lsregister -f -r -v -u {path_to_parent_folder} version of the args to unregister an old bogus entry (and -v to see what was going on). Note that you can’t get rid of an entry at a path that no longer has the file – I had to put a copy of the app into the trash, run the -u version and then quickly empty the trash in order to get rid of an entry referencing it there.

In 10.5.x this tool is in the LaunchServices.framework/Support/ folder. LaunchServices is in CoreServices.framework/Frameworks/

or (sorry about formatting)

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/ 

Note that in 10.6 this tool has moved to

/System/Library/Frameworks/ApplicationServices.framework/Frameworks/LaunchServices.framework/Support/

and may have other commands (I was working in 10.5.8).

ok. Now I can find this info again when I forget ūüôā

iPhone App Developers: Get Info Version Tip

This is pretty simple, but something that isn’t in the default iPhone application templates in Xcode (well, under 10.5.8 anyway).

Background:

Most developers these days are putting the SCM revision number as the CFBundleVersion (either directly or by using another BUILD_VERSION user defined property and then setting the CFBundleVersion to ${BUILD_VERSION}), generally via a build script.

When building an iPhone application one generally distributes the app to testers via the Ad Hoc distribution option. ¬†Testers will often receive multiple versions over the course of the beta cycle. ¬† Unfortunately, there isn’t an easy default method for them to see which version is which in either iTunes or the Finder because generally you are only supposed to put the ¬†${CURRENT_PROJECT_VERSION} into the CFBundleShortVersionString field/property.

In default Cocoa about boxes, Cocoa automatically builds a version string of CFBundleShortVersionString (CFBundleVersion) which is really what we want. ¬†Regrettably, iTunes 9.0.2 doesn’t do something similar when showing Get Info for iPhone applications (radar://7566172).

For Mac Applications, the Finder Get Info window seems to show the CFBundleGetInfoString, if present, or else the CFBundleShortVersionString if not (at least in 10.5.8).

Technique:

So one easy answer is to simply to define a BUILD_NUMBER user property in the info.plist file and have your SCM script populate this property with the current revision number for the build (or set it in this one place manually).  Then define your CFBundleVersion to be ${BUILD_NUMBER} (for SPOT) and include a CFBundleShortVersionString property in the info.plist file and define it to be  ${CURRENT_PROJECT_VERSION} (${BUILD_NUMBER}).  Now testers can tell versions apart simply by doing a Get Info on them in the Finder.

The next post will talk about an easy no-runtime-code method of showing this more useful version string in the iPhone Application’s settings panel and still maintaining a SPOT (single-point-of-truth) for the build number. ¬†Until next time…

United Broke His Guitar – awesome!

This story is really awesome. ¬†If you haven’t seen or heard about this, check it out!

Having had airlines harass me about guitars before, I can totally relate to this.
Start here:

http://www.davecarrollmusic.com/story/united-breaks-guitars

Then go see the video here.  The first one is by far the best:

http://www.davecarrollmusic.com/music-videos

I’d say: ¬†Dave Carroll: 10, United: 1; game over!