iPhone Development

Austin Startup Weekend 2012 – My team

I decided to do Austin Startup Weekend this weekend, which was my first Startup Weekend. It’s an interesting format – you come in and pitch your ideas, then form teams around those ideas and execute over the weekend. The idea I pitched attracted some interest, but I don’t think I explained it very well – you get 60 seconds to state your problem, who you are, how you plan to solve it, and who you need – that’s really hard! I only decided to pitch on Wednesday, but actually thought I was going to do a pretty good job. In any case, it’s great preparation for when I actually have to pitch a real product or startup.

I joined up with a smaller team, because I knew one of the team members from a previous Austin API Hack Day, so I knew he could do a good job – we found an interesting niche, solving the no-show problem in the hair salon/spa industry, but it’s pretty hard to do customer development there. I built a push-notification driven trending daily deals app on the iPhone, and an availability management app for the iPad on Saturday, and then spent most of Sunday on polishing the app. I used Urban Airship for the first time as a push notification provider, because I figured that was easier to set up than to set up push notifications coming out of the server.

API vendors like Twilio and Parse really spoil me – comparing Urban Airship’s API directions for a mature product they have had for years to Twilio’s brand new iOS client documentation really shows that investment in quality developer documentation just makes sense.

Anyway, I have a pretty decent iPhone app out of this – some screenshots:


DrupalCon Denver 2012 Video and Slides from my PhoneGap+Drupal presentation

Check out the video and slides for Fabian Franz and I’s presentation on autogenerating a mobile application from a Drupal site using PhoneGap. We gave the talk on Wednesday at DrupalCon, and the video is already posted!

Drupal and PhoneGap video and slides

Drupal Planet iPhone Development

Ubercart CRM for the iPad: My DrupalCon 2012 Twilio Developer Contest Entry

I won 2nd place (and a Kindle Fire) in the Twilio DrupalCon 2012 Developer Contest with an Ubercart customer support iPad app. The idea is that a e-commerce site customer support representative could use an iPad that not only handled customer support calls, but also showed the customer’s most recent order information as soon as they call.

I’ve been to a couple of dev days/hackathons sponsored by Twilio, but I’ve never had a chance to actually use Twilio in an app or project. Twilio is a voice-over-IP provider that lets you add voice capabilities to your web application or iOS mobile app. It also handles SMS sending and receiving, if you’re doing text messaging.

Twilio iPad Ubercart Drupal App

Twilio just came out with an iOS SDK, which I thought could be pretty interesting for their DrupalCon Developer Contest up in Denver. The first step I took was to research different ways to use Twilio in Drupal, and I ran across the voip modules – unfortunately, they were only released for Drupal 6 (beta 9), and when I tried out the Twilio integration, I ran into lots of little errors, and Twilio couldn’t connect to my Drupal 6 site. I need to go back and file some issues in the issue queue. I dropped the VOIP Drupal modules, and simply followed Twilio’s directions for integrating the iOS SDK with a standard PHP app, and then rolled that into a Drupal 6 module and dropped it on the server. This actually worked really well, and pretty quickly, I had a phone number I could call from my iPhone that would ring my iPad, and then my iPad could answer the call and I could have a nice, illuminating conversation with myself. Luckily no one walked in on me talking to myself and a few Apple devices. From what I understand, the Twilio SDK is coming to Android pretty soon, and I would imagine the Drupal integration would be exactly the same.

So I had a great little app thrown together for calling someone on an iPad through a telephone number, but that’s not the most exciting thing. Luckily Twilio had one of their developer evangelists stationed in a room at DrupalCon, so I picked his brain about what to add – he suggested CiviCRM, but I’d used that before and didn’t think I could get that integrated in 6 hours. I liked the idea, though, so I went with Ubercart, even though I’d never used it before. Ubercart was actually super easy to set up, so no real issues there. The only catch was trying to figure out how to integrate Ubercart with the iPad app – I ended up rolling my own integration with JSON, because I needed to search Ubercart orders by phone number, and I needed to pull the products that the order contained as well.

On the iPad side, I used the AFNetworking library, which makes asynchronous network calls extremely easy. I also created a user interface in the Apple’s XCode Interface Builder, which is more or less drag-and-drop for positioning UI elements.

That actually took a decent amount of time, simply to get all of the UI elements into place that a customer service rep might need from someone’s order. I wrote some Objective-C to set the properties on each of those UI elements from the JSON returned by my Drupal/Ubercart integration module, and the app now could show order information!

I read the email saying I was selected as a finalist for the Developer Contest around 8am on Wednesday, and I would need to do a 10 minute demo at 5pm – that was great, but I was giving a presentation on PhoneGap and Drupal at DrupalCon at 1pm, so I couldn’t really worry about the Developer contest demo until after that 🙂

There were two other great entrants at the Developer Contest – VuzzBox and Drupal SMS Server – so that was cool to see that there was such a wide variety of things you could do with Twilio and Drupal.

I came in second place, which I’m really happy with – I basically entered the contest so I would have something to keep me from going nuts worrying about my PhoneGap presentation before DrupalCon started! Now my plans are to figure out if there is an actual need or desire for this app with some of the e-commerce/shopping cart packages out there – if this sounds interesting to you, let me know!

Drupal Planet iPhone Development

Drupal 7 Map App Example Project for iPhone and iPad

GitHub Project URL –

I like writing native iPhone and iPad apps with Objective-C. What I don’t like doing is writing the same code over and over again – it would be great to have a starting point that I can use again and again. I find myself reusing classes, open source libraries, and design patterns from previous apps when I build new ones.

What I’d like to do is share a starting point for creating iOS applications for Drupal sites running Services 3. Because Drupal can do many different things, this isn’t going to be a general-purpose Drupal client that you can just point to a Drupal server. Instead, it’s meant to be the first 20% of a mobile application project.

I’d like to get feedback from others about how they would use this, and what they would like to see in the project.


This project is an example iPhone/iPad application with a common code base that pulls location-based information about businesses from a Drupal 7 web site, displays it on a Google Map inside an iPhone or iPad app, and then lets you pick a business to display.

Credit to Open Source iOS Libraries used in this App

Drupal 7 Setup

I’d like to bundle all of the Drupal 7 functionality together into a Drupal “app” (different from a mobile app), or possibly just a feature. Basically, the modules you need are:

  • Services 3
  • ctools
  • Geocoder
  • Geofield
  • Views
  • Services Views Address Field

I added a REST endpoint with access to get nodes, and access to get views. I also created a content type called business with an image field, an address field, and a geofield. There’s a simple view that just returns all businesses, but I would like to improve that with proximity search. Unfortunately, the current proximity search solution for Geofield doesn’t seem to let me alter the origin point from the view’s arguments, so there is some work to be done there.

I used the Acquia Dev Desktop to build this Drupal 7 site locally, so I don’t have it up and running on a server just yet.

The URL for your Drupal site is in AppData.m – change the REST URL to match your site’s end point, and change the image URL to match your site’s image directory for large image thumbnails.


Send them to

Or get in touch with me through my web site or

iPhone Development

API Hack Day Austin Winner: Hotel Deals iPhone App

I had a lot of fun on Saturday entering the Austin API Hack Day held at Hub Austin Coworking in South Austin. I came to API Hack Day last year without a plan or a particular project to create, and then sort of browsed through the InfoChimps and Mashery APIs to find something to create – our team ended up creating Application Trail, which was a jQuery Mobile web app for finding hotels along the Appalachian Trail, but it was sort of half-baked and didn’t really work.

Part of that was just the process of building a team from scratch – 4 developers who didn’t know each other before the event (well, I’d actually gone to grad school with Alex, so it was great when I saw him there, but hadn’t seen him in four years, or ever written a program with him). Chances are, you don’t share too many languages, environments, or even basic development tools in common – for instance, GitHub + Rails + heroku – great if you’ve done it before, but if that’s the first time you’ve touched any of that, 8 hours isn’t enough time to start to contribute to a project.

This time around, I knew what I wanted to build before I got there – I’d spent last week in Florida with my wife for the Florida Drupal Camp in Winter Park, and the 26.2 with Donna Marathon in Jacksonville Beach, and we stayed at several hotels that we found with Hotwire Deals. Unfortunately, Hotwire doesn’t have any mobile apps – just a mobile web site that I found hard to use. What Hotwire does have is an API exposed through Mashery, which was one of the sponsors of API Hack Day – I was able to build an entire iPhone app around the Hotwire API in 8 hours!

This little app won the Mashery API Prize, and the grand prize for Austin API Hack Day. I’m really happy with it, and getting it ready to go live in the App Store!

iPhone Development

My new mobile app company, Biscotti Labs!

Some exciting news – I’ve started a new mobile app development company, Biscotti Labs, to build mobile applications for Drupal sites!

I’m happy to work with existing Drupal sites, or on brand new projects, but my focus is on building out the mobile apps – not on Drupal module development, theming, or site building. I’m looking to partner with Drupal shops and freelancers, not compete with them. I do know my way around Drupal and most key contrib modules, and can even write a module or two if you need them.

I can develop native iPhone/iPad apps with Objective-C or hybrid apps for iPhone/iPad/Android using PhoneGap and HTML5/CSS/JS – let me know if you don’t know which is right for your mobile application strategy. Some factors to consider include budget, desired user experience, internal development skill set, and target audience.

jQuery Mobile Phonegap Uncategorized

First chapter of the PhoneGap, Drupal, jQuery Mobile e-book is up!

I’m excited to announce progress on my new e-book on PhoneGap, Drupal, and jQuery Mobile! I gave an interview on using Drupal with PhoneGap to Brian Lewis at Modules Unraveled last month. In addition to the podcast, which I really enjoyed making, I recorded a screencast on setting up PhoneGap, which I hope you enjoy.

The first chapter of my e-book covers the same ground, so I decided to release it as a free PDF, which you can download and enjoy. I’m happy to hear any feedback you have! I also wanted to let people read the first chapter for free, because you need to have a Mac with XCode 4 to follow along with the book, and I don’t want anyone to buy the book if they can’t use it.

Download Chapter 1 (1.1 Megs)

Drupal Planet Phonegap

Drupal + PhoneGap Podcast with Jeff at Modules Unraveled

Check it out! I did a podcast with Brian Lewis of Modules Unraveled, and it’s live today on his web site: Drupal and PhoneGap podcast. I had a lot of fun recording the podcast, having never done one before.

Also, I went ahead and did a screencast – most of it is setting up a a basic PhoneGap app in XCode 4 for iOS, with a little dash of Drupal+jQuery Mobile towards the end. Check that out on YouTube – I’d never done a screencast either!

Jeff Linwood – PhoneGap for Drupal

jQuery Mobile Phonegap

Announcing my eBook – jQuery Mobile + PhoneGap + Drupal 7

Last year, I worked on a blog post series about building a jQuery Mobile HTML 5 App with PhoneGap and Drupal 7. After getting really deep in the weeds on that project, I ended up with some very complicated JavaScript to manage the creation of Drupal nodes with an authenticated user.

That experience led directly to my creation of the Drupal Plugin for PhoneGap for iOS, which I used to really clean up the JavaScript needed to make a connection to Drupal. I’m really excited about getting Drupal developers into building mobile applications, and I’ll be co-presenting on Drupal and PhoneGap at DrupalCon Denver 2012!

I’m excited to announce that I’ve been rewriting that blog post series into a more thorough, step-by-step guide to building an HTML5/CSS/JavaScript app, and I’m going to make it available as an e-book! I’ve published several traditional programming books with Apress, and while I enjoy working with them, it can take a year or two after a project gets started before a book comes out on the shelves. This time around, I’m going to publish directly as a PDF that you can download.

I’m currently in the writing/revising stage of the project, but would love to hear feedback and line up some reviewers – contact me through this web site if you’re interested! Join the mailing list below, and I’ll keep you up to date with the latest announcements and updates.


iPhone Development

Migrating an iPhone app off of Three20

I decided to give my EveryMarathon marathon calendar iPhone app a few tweaks and release an updated version while watching a college football bowl game on TV – easy enough, right? I’d developed the app on my old MacBook Pro using Three20, which is an application framework for iOS.

Choices, choices

I didn’t have Three20 on my new MacBook Air, mostly because I wasn’t using it for any current development projects – it’s not maintained any more from what I can tell, as the lead developer moved on to a new framework, Nimbus. I’m not using that either – instead I wrote a boilerplate iOS application template I like to use for new iPhone and iPad apps, especially if they need to talk to Drupal or another REST service.

I had two choices at this point – download and build Three20 as a set of static libraries (major pain in the neck last time I tried, and I think things probably got worse when XCode 4 was released) and tweak the app, or port the whole thing off of Three20 to Apple-standard UIKit code. Luckily, there were a few more football games on TV, so I decided to drop Three20 completely.

Three20 Tables

The one thing I really liked about Three20 was the reasonable handing of table views and data sources – much easier than working with UITableView and its delegate and datasource.  Rewriting all of my table datasource code was a pain in the neck, but it was easy enough to test as I went. I’d commented out all Three20 related code, and removed all references to its header files throughout the app, so I was able to get something running, even if it didn’t do anything, pretty quickly.

Three20 Navigator and URLs

The real mess came from replacing TTNavigator, which I’d initially thought was pretty clever, but as soon as you try and do any special cases, completely falls apart. Basically, the idea is that each controller in your iPhone app maps to a URL, which then you can call from any other controller when a button is pressed, or a table cell is selected, or what have you.

The problem with TTNavigator is that you can’t pass objects in these URLs without some major hacks, but if you write your app using UIKit, you can simply pass an object to a UIViewController in an init method, or set it using a property setter method. Three20 heavily relies on these TTNavigator URLs, and you end up with some weird overloading of default UIKit arguments (such as target in a navigation bar button) to get it all to work. Basically, it’s not pretty under the hood.

Rewriting all of the TTNavigator stuff was pretty straightforward, once I rationalized out my use of arguments in TTURLs – for instance, I was passing Drupal node ids instead of just the object, and then relying on my data singleton to resolve the node ids into objects.

Three20 Tab Bar

Ripping out the Three20 tab bar controller was straightforward – I subclassed UITabBarController instead, replaced the Three20 URLs with instances of the view controllers in navigation controllers, and it all pretty much worked.

TTWebViewController is pretty nice, but I replaced it straight up with SVWebViewController, and it’s basically a drop-in replacement, without relying on a whole bunch of other stuff.

Now that the app doesn’t rely on Three20, creating an iPad version should be pretty straightforward, especially as the app doesn’t have a fancy user interface. Three20 had a couple of branches that maybe supported iPad use, but it seems like the TTNavigator is really holding the app back.

If you have any questions about migrating your Three20 apps over to UIKit, let me know – I didn’t try to migrate the app over to Nimbus, but I don’t think all of the features in Three20 are in Nimbus yet anyway. My biggest problem with Three20 is that once you use it, you’re more or less stuck using it for everything, and it’s tough to bring in third-party or Apple code that doesn’t support it.