Archive for category Code

Android UX (still) fails

I don’t usually get deep into the fray on iOS vs. Android. Yes, I’m a completely devout Apple fan myself: I use a Mac at home and work, own pretty much every other Apple device on top of that, and have such a strong iPhone preference that I happily eBayed not one but both Androids I got for free at Google IO a few years back because, well, after a week of serious benefit-of-the-doubt were still worthless pieces of junk compared to my aging iPhone 3G that could actually join WiFi networks and check my corporate email. And then a month later I bought an iPhone 4.

But again, I usually don’t go out of my way to rant about this. Tonight is an exception. I’m working at a startup again that’s heavily focused on mobile applications and as such am getting quite a bit more plugged in to the Android experience, even though I’m still doing the most hands-on work with our iOS offerings. To that end it was high time I ditch the simulator and start running our Android app on a Real Device for some side-by-side comparison, and today picked up a brand new Droid Razr for the task. Even though I’m basically planning to use the device for nothing beyond Phone, Email, Calendar, and our in-development application, I thought I might indulge in one tiny personalization and set the wallpaper to a recent photo of my kid. I’m a proud dad after all, and spend a hell of a lot of time staring at these screens. That’s where the fun began.

As an Apple user I’m of course all synced up with Photo Stream and iCloud but that doesn’t help me much on my new Android. No worries though, I also use Flickr to share with family and have lots of great original-size photos in albums there. This will be a piece cake! Paging quickly through the installed apps and device setup wizard I find, of course, Picasa and Photobucket but no Flickr. Oh well, guess I lost to the OEM dice on this one, so over to the Market to grab the Flickr app. The app crashes on launch. Not Android’s fault I guess, the Flickr guys probably just have better things to do than make their Android app stable and obviously the Market will let you publish anything. On second launch I’m able to access the login screen, and being on an Android figure I’ll use the option for Google auth since that’ll probably be seamless. Alas, it kicks me over to the same generic Google web SSO screen I’d see in a browser – even though I have entered my Google ID in at least five places on this phone – and it’s an Android FFS.

Just as I’m about to start typing my email address something else catches me eye. The keyboard has a little microphone key at the bottom! I know this key, it’s there on my brand new iPad and hails all manner of bleeding-edge voice recognition at my disposal. So I click it and humbly but articulately recite my beloved email address. The phone thinks briefly and seconds later comes back with a perfect match. That is, a perfect match that is completely useless in this field and would be so much work to edit that I end up just clearing the field and typing it anyway: it had entered, literally, “dustin dot mallory at”. What could be a more glaring UX failure than engineers who have so perfected this fast, accurate recognition yet it has absolutely no clue I’m in an email field? Especially considering that the field asserts this specifically – which is why I’m seeing an emailish keyboard and not the generic text keyboard – is wiring up the same basic context to the dictation button too much to ask?

I suspected not, so of course I immediately jumped over the the Flickr login screen via Google auth on my iPad. And again, I used the dictation button and recited “dustin dot mallory at gmail dot com”. Guess what it entered? You’re damn right it did. That’s how a device is supposed to work!

But the fun doesn’t end there. This filled me with such glee I thought I’d take some screenshots so I could show my wife, rage-blog about it, and poke fun at everyone using an Android at the office tomorrow. So I quickly pressed home and sleep to grab an iPad screenshot knowing it would immediately be synced via Photo Stream to my Mac for easy access. I would probably have to email the Android version, but whatever, I can handle email. I wonder how I take an Android screenshot? Seems like there were issues with it when I tried it on those phones from Google a couple years back but I’m sure it’s better now after, what, three major versions of the OS. So for kicks I try a few combinations of the power button, the side button, and whatever the hell you call those four buttons along the bottom where my home button should be. Nothing. I poke through the apps and settings looking for something screen capturish. Still nothing.

I pull up the Market and search for “screenshot”. There are definitely a handful of apps that do it, but most have sketchy reviews and all-caps warnings that U MUST ROOT UR PHONE 4 THIS 2 WERK. Really? So I download one of the free ones just to try it for myself. I clearly picked a loser not only in its ability to take screenshots successfully but also at engaging in the English language. For the guy who wrote this thing’s sake, I really wish someone who cared was reviewing these apps and giving some pointers in the right direction.

I consider shelling out 4.99 for the super pro version that will work, guaranteed, even if I don’t want to root my phone or speak English. But then I remember that I have an iPad that actually works sitting next to me, so I just take a couple physical physical pictures of it the old-fashioned way and they’re ready to go. Not just captured, but happily synced over iCloud, already over on my Mac, so I can finally rage-blog to my heart’s content.

Don’t worry Apple. If there was any remote chance I might stray from my aging iPhone 4 to this shiny new imposter it was obliteated not just by the epic failure I ran into doing something so basic, but the somber realization that this is no longer a bleeding-edge technology being adopted only by uber geeks like myself as it was a few years ago, it’s mainstream with years of experience, vendors, and community behind it. A whole pile of things contributed to the failure you’re seeing here, but the platform surely enabled most of them. Then again that never stopped something from gaining cheap, grudging acceptance by the masses even though it sucks, and making both the peddler and their OEM cronies a pile of money in the process. Just ask Microsoft. But I’m glad Apple is (finally) making more because it’s well deserved.

Now back to doing something fun on my iPad.

, , , ,

No Comments

Using git svn on OS X 10.8 Developer Preview

After installing the OS X 10.8 Mountain Lion Developer Preview I noticed that while git and svn both worked independently, I started receiving the following error trying to use git svn:

Can't locate SVN/ in @INC (@INC contains: /Applications/ /usr/../Library/Perl/5.12/darwin-thread-multi-2level /usr/share/git-core/perl /Library/Perl/5.12/darwin-thread-multi-2level /Library/Perl/5.12 /Network/Library/Perl/5.12/darwin-thread-multi-2level /Network/Library/Perl/5.12 /Library/Perl/Updates/5.12.4 /System/Library/Perl/5.12/darwin-thread-multi-2level /System/Library/Perl/5.12 /System/Library/Perl/Extras/5.12/darwin-thread-multi-2level /System/Library/Perl/Extras/5.12 .) at /usr/libexec/git-core/git-svn line 61.

It turns out the path for the svn perl library has moved as part of the Xcode 4.4 restructuring. Since most package managers like Homebrew or MacPorts may not work correctly on the 10.8 preview yet, and the CollabNet svn binary installer is also not updated, it’s easiest to continue using the versions of git and svn bundled with the Xcode 4.4 command line tools and adjust the perl include path to work with the new layout.

To do this:

  1. Ensure that the Xcode 4.4 command line tools are installed (this is now done from within Xcode under Preferences -> Downloads -> Components).
  2. Add the following environment variable (or append to it as needed if you’re already setting it elsewhere):
    export PERL5LIB="/Applications/"

After this git svn should work correctly again!

, ,


MacBook Pro is finally a desktop replacement again

I just built a loaded up MacBook Pro for my new job and am relieved to find that, finally, they’re viable as a desktop replacement for development work again! I’ve been using an iMac + MacBook Air combination for the past year or so which worked fine when the bulk of my real productive time was at the iMac and the laptop was just for the occasional meeting and travel, but I’m now at a startup again I really one portable computer that does it all wherever I need it.

Based on the recent benchmarks I figured the late 2011 upgrades would put the MBP in the desktop contention range and I was right: quad core, the ability to finally get 16GB SODIMMs as 2×8 for under $200, and the relative cheapness of a blazing-fast third-party SATA III SSD upgrade (I went for a Crucial M4) makes it come in only a hair beneath a fully-loaded iMac (graphics capabilities aside) for somewhere in the ballpark of $3k. Of course, that’s without a 27″ display – but as much as I still love my 27″ iMac at home I honestly found the extreme glossiness pretty bad under office lighting anyway, and am more than happy to wire up a couple generic 23″ anti-glares for a fraction of the cost!

Overall, it’s a killer machine for doing tons of iOS, Android, and miscellaneous server development side-by side with all the IDE’s open and a pile of devices connected without so much as a hiccup, and as a quiet computer fanatic I love that I really have to go out of my way to push it before I ever hear a fan.


No Comments

Automated iOS Jenkins builds with application tests and Core Data

I recently started some iOS development with a new team and had the chance to set up a server for continuous integration builds. Since our teams are already familiar with Jenkins that seemed like the logical place to start, and the Xcode plugin available works reasonably well out-of-the-box for simply building the application. However, running tests – especially what Apple calls application tests (anything accessing a bootstrapped NSApplication through the simulator) using Core Data – took a little bit of tweaking. Here’s what was needed as of Xcode 4.2.

  1. Install the latest version of Jenkins, either on a Mac with Xcode installed or another server that has such a Mac available as a slave for any iOS builds
  2. Install a plugin for your source control system of choice if not already present (I’m using Git with the default Git plugin - considering the great Git support added in Xcode 4 with Git repos enabled by default, if you’ve been looking for an excuse to switch this is it!)
  3. Install the Xcode plugin
  4. Create a build following the plugin build instructions for a basic release build of the application, and especially pay attention to the keychain notes (I went ahead and entered the login password of the build account so that Jenkins could unlock it itself)
  5. Run a build and verify that everything is successful up to this point, and if not, troubleshoot
  6. Edit the build and add a separate build target for testing following the plugin test instructions, specifying iphonesimulator as the SDK (you can enter a full absolute path like the example if you wish, but simply iphonesimulator should find the latest), and make sure it points to your project’s test target instead of the primary build target (e.g. MyAppTests instead of MyApp)
  7. Run a build and look for errors. Assuming you have one or more application tests expecting to run in the iOS simulator it will probably have skipped all the tests with an error like ”Skipping tests; the iPhoneSimulator platform does not currently support application-hosted tests (TEST_HOST set).”
  8. To fix the error above (or prepare for it, if application tests don’t exist yet but will eventually), on the Jenkins server (or slave if running the iOS build on a slave) edit:
    /Developer/Platforms/iPhoneSimulator.platform/Developer/Tools/RunPlatformUnitTests (if Xcode <= 4.2)
    /Applications/ (if Xcode >= 4.3)

    and change line 95 from:

    Warning ${LINENO} "Skipping tests; the iPhoneSimulator platform does not currently support application-hosted tests (TEST_HOST set)."

    to these 2 lines:

    export OTHER_TEST_FLAGS="-RegisterForSystemEvents"
    RunTestsForApplication "${TEST_HOST}" "${TEST_BUNDLE_PATH}"

    as described in Xcode 4: Running Application Tests From The Command Line in iOS (and if you want to be able to run command-line builds with tests on any local developer environments, like xcodebuild -target MyAppTests -sdk iphonesimulator, this is the step to do on each of those as well)

  9. Run a build again and look for errors. Assuming you have application tests for portions of the application using Core Data, you may see an error relating to the storage URL like “Error validating url for store”
  10. To fix the error above (or prepare for it, if the application doesn’t use Core Data yet but will eventually), you’ll need to change several of the configuration methods for Core Data to operate differently during command-line tests as described in iOS Unit Testing with Xcode 4 and Core Data; not covered here is how exactly to detect if you’re in a test, which I did by checking the WRAPPER_NAME environment variable like this (and I have local data being written inside the generated ./build directory):
    * Determine if application is running from a test inside an external command-line build by xcodebuild.
    - (BOOL) isExternalBuild
        NSString *wrapper = [[[NSProcessInfo processInfo]environment] valueForKey:@"WRAPPER_NAME"];
        return wrapper != nil && ([wrapper rangeOfString:@"octest"].location != NSNotFound);
    Returns the managed object model for the application.
    If the model doesn't already exist, it is created from the application's model.
    - (NSManagedObjectModel *)managedObjectModel
        if (__managedObjectModel != nil) {
            return __managedObjectModel;
        if([self isExternalBuild]) {
            NSArray *bundles = [NSArray arrayWithObject:[NSBundle bundleForClass:[self class]]];
            __managedObjectModel = [NSManagedObjectModel mergedModelFromBundles:bundles];
        } else {
            NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"MyApp" withExtension:@"momd"];
            __managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];
        return __managedObjectModel;
    Returns the URL to the application's Documents directory.
    - (NSURL *)applicationDocumentsDirectory
        if([self isExternalBuild]) {
            NSString *dir = [NSString stringWithFormat:@"%@/build", [[NSFileManager defaultManager] currentDirectoryPath]];
            return [NSURL fileURLWithPath:dir];
        } else {
            return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
  11. Run another build and look for errors. If you see a more generic error along the lines of “UISplitViewController is only supported when running under UIUserInterfaceIdiomPad” or messages like “Timed out trying to acquire capabilities data.” during the run, your build server may not have the necessary scheme metadata from Xcode.
  12. To fix the error above, first make sure you’ve checked the Shared checkbox in the Manage Schemes dialog of your project, which will place some additional metadata in the project directory that you can commit to source control (but make sure you don’t then ignore them!) as described in Managing Schemes
  13. If you still see the error the iOS simulator probably has not been launched on the build machine since the last restart; it must have run once to start the necessary services but also cannot be open when the test runs, so to handle this automatically you may want to add a simple execute shell targetat the beginning of your build like:
    open '/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone'
    sleep 3
    killall 'iPhone Simulator'
  14. Run another build and hopefully this one works! If not, post the additional steps required and I will add them to this checklist.
  15. Once everything is working perfectly in Jenkins you’ll want to confirm that you can still run both the application and any test targets successfully in the simulator or on a device directly through Xcode. The steps here should support this unless you’ve missed something.

, , , ,


Remembering Steve Jobs

Steve Jobs passed away yesterday and I’ve been struck by the outpouring of appreciation and remembrance from consumers and the industry alike.

For me, Apple products and culture have always been the pinnacle of why it’s cool to do the kind of work I do, and nobody embodied this better than Steve himself. As a bit of a fanatical perfectionist myself I love that Steve never settled for second best and pushed people hard not to drive them into the ground, but to hone them and their ideas into the very best they could possibly be. But even more importantly he wasn’t just the king of geeks as so many giants in the industry are, but a real consumer’s inventor building things that made computers, the internet, and portable music accessible not just to tech heads like me but to my friends, my parents, and now even my baby.

My connection to Apple and Steve is also a sentimental one. My family’s first computer was an Apple IIgs on which I wrote my first programs in elementary school (yes, in BASIC), and when I got my hands on a Mac Plus and eventually newer Macs I was consumed with tinkering with the Finder in ResEdit (replacing the Welcome to Macintosh dialog icon with my face was a favorite of my parents), building crazy apps with HyperCard, and generally being mesmerized by MultiFinder, AppleTalk, and so many other now-defunct Apple ideas that made things “just work” in an era when absolutely everything about computers and connectivity was a nightmare. I gained plenty of experience tweaking out Unix, later Linux, and Windows setups with friends, school, and work, but my heart was won by Apple. I became that guy who had to do everything just a little bit better on his Mac. When I finally managed to save up for my first computer that was “all mine” in middle school, it was a Mac (and the Mac price premium in the 90′s was still no joke!), and when I downloaded my first MP3 (New, if you must know) it was loving played on my very own Mac using Audion. I hauled my Mac around to LAN parties and then eventually off to college.

Not far into college, and already working at a company producing mainframe-esque software that had very little in common with Apple, I was lucky enough to get on board the Apple University Program and win a free tip to the Apple WWDC that year. While I couldn’t realize the significance at the time, this was a really pivotal time for Apple: Mac OS X had just gone beta and they were on the verge of iTunes and iPod taking the world by storm. We happily piled into our campus rep’s company van and trekked from Boulder to Cupertino, tinkering with our Apple-provided Blueberry, Lime, and Tangerine iBooks (back when this was a laptop not an eBook!) all the way. Once there we got to hear more about how Mac OS X was going to change the world, see the iTunes visualizer splashed across every projectable wall in site, and bask in the notorious “reality distortion field” from Steve himself. And if the trip wasn’t already enough, I was lucky enough to be the winner of a brand new white iBook from their random drawing! I proudly vowed to use it for all my ongoing Unix and Java development. Steve told us all that if we were serious we should really come back and work at Apple that summer, and while I didn’t take him up on it every hyped Apple product release since (which in retrospect, this one surely paled in comparison to), makes me smile and think of this trip right as Apple was on the verge of becoming the king of consumer computing.

Now, Apple products provide not just some elitist way I can do everything with my computer better and easier, but a complete transformation of how I live my day. Mac at work, Mac at school, iPod in the car, iPhone, iPad, Apple TV… there’s nothing I couldn’t do per se without any one of these, but replace them with the runner-up across the board and it would be a very mediocre experience indeed. Every day for me and millions of others is more productive, more enjoyable, and more wonderful because of these ideas that became products that became staples of how we relate to technology, and ultimately, each other.

Steve, you were the ultimate inventor who knew what the world wanted before we did and a model for accepting only the best for all of us who build hardware, software, and user experiences for a living. Thank you for making our world so much better and the brilliant legacy of Apple (and Pixar!) to continue to amaze us for many years to come.