What’s In Your Dock: iPhone edition

It's been a while since I've been desparate enough to had a chance to do a nice "what's in your toolbox" kind of post. In honor of the iPhone 3.0 upgrade, and Steve Jobs' liver, let's do an iPhone-toolbox post.

I'm unabashedly happy with my phone, because it's strengths and weaknesses mesh pretty well with my actual needs. It's not that great a phone, but I don't use the phone that much. On the other hand, there's never been a better gizmo for whiling away a long train commute.

So, here's some stuff I use:

Instapaper (free light version, $9.99 pro version currently on sale for $4.99)

Instapaper has probably changed my web reading habits more than any other app since I started using RSS readers. It's so simple that its almost hard to believe how useful it is. When I come across an article on the web I want to save for later, I click a bookmarklet. Later, launching Instapaper on the phone, the article shows up, with the images stripped away, and the text presented in a reader friendly format. (Sometimes you can help Instapaper out by invoking it from the printer-friendly version of a page...)

Using Instapaper has become kind of second nature -- I always have a few articles ready to go. The Pro version adds a few nice features, including control of the display font and the ability to scroll the article by tilting the phone. The tilt-scroll sounds like you'll need to be a gymnast or something to read an article, but in practice it's a super-clean interface for reading long articles and letting the text scroll at your reading speed. Great app.

Birdhouse ($3.99)

Very well designed little app for what seems like a dumb use case -- saving drafts of posts intended for Twitter. I mean, how much do you need to polish that tweet about the ham sandwich you had for lunch, amirite?

But, if you are trying to do a tip a day on Twitter (@railsrx), then having a nice place to store up ideas for future tips is great. The app also works as a slightly structured note-taking app, since it can email it's existing draft population back to you.

Stanza / Kindle (Free)

The two leading general-purpose eBook readers, both of them are easy to use, and manage the task of making text readable on an iPhone. It'd be nice if there was some consistency in formats between the two apps, and also if you could buy books directly from the Kindle App (presumably that's coming).

MLB At Bat ($9.99)

Obviously only if you are a baseball fan, but the app gives you access to live box score and play-by-play data, live audio stream of radio broadcast, video highlights, special goodies like condensed game videos a few hours after games and, plus live video streaming on a currently limited basis. That's a lot of stuff. Add in the fact that the app is pretty enough to have won an Apple Design Award, and it's a pretty fabulous package.

Twitteriffic (Free lite, $3.99 no-ads)

There are something like a zillion Twitter clients on the iPhone at last count, and which one to pick is basically idiosyncratic. It's a mark of how fast iPhone development is going that Twitteriffic 1.0 won an Apple Design Award in 2008 and was completely blown away by newer clients six months later before regaining strong status with the 2.0 release. I find this has a nice blend of features and interface. (Tweetie, which is my desktop client, is also very good on the iPhone).

Of course, this all sounds serious -- the big winners on the iPhone have all been games, there are all kinds of inexpensive, addictive little games I play. Here are a few: Defender Chronicles, The Creeps, Drop 7, Flight Control, Frenzic, Galcon, Peggle, Strategery.

Topics:

5 things I can do with my windows mobile phone that you can’t do with your iPhone

samsung_blackjack2
After playing with my friend's iPhone for awhile, and using the company phone for testing out our iPhone applications, I started to get really jealous of how cool it is, and how uncool my samsung windows mobile phone seems by comparison.
The more I used the iPhone, the more I got upset at my windows phone and started demanding "Why can't I do this on my phone?", and the more I found that there were apps out there that I didn't even know existed, as one of big problems with the windows platform is that its not easy to find good apps.
So here's my take on how to make your windows phone better, and what it can do for now that the iPhone can't do.

Continue reading »

Which Mobile Platform Should You Target - Other Points of View

Our two part series Which Mobile Platform Should You Target - on web apps and on native apps - generated a fair bit of feedback, especially from those targeting cross platform development.

Here are a few other points of view on the subject - there is certainly no shortage of opinions and angles:

What's your take?

Which Mobile Platforms Should You Target? (Part 2)

mobilelogos4In the first installment, we covered the simple case, where your application is really a web app, not really using any device features, without local storage, just pulling data from a web application.  This time, we’ll tackle true native applications.

Continue reading »

OCMock: Handling Boolean Return Types with NSValue

iPhone in Dock

Testing your iPhone application, you may at some point in time need to stub a method call whose return type is a boolean (or some scalar value, or C based structure). The way to implement this (as described in a discussion on CocoaDev here) is to wrap the boolean in an NSValue using the OCMOCK_VALUE() macro defined in OCMockRecorder.h.

While this solution technically works, I find that doing this within the test class itself makes the test cases a little less readable along the way. Instead, I found it useful to extend OCMock to do this type of conversion for me, keeping my test code a bit cleaner as a result.

Let's take a look at an example by examining the set up for a simple test case..

Continue reading »

Book Review: Core Animation for Mac OS X and the iPhone


book cover

In Core Animation for Mac OS X and the iPhone, Bill Dudney gives a good introduction to the Core Animation framework and some of the slick ways that you can spice up a Cocoa app for Mac OSX or the iPhone. Its assumed that you know your way around Xcode, and that you know the basics of Cocoa programming. So if you are new to Cocoa you may want to have a copy of Cocoa Programming for Mac OS X handy, but you can get your hands on the code examples from Pragmatic Screencasts if you want to try and work your way through it.

The book gives a fair overview of the Core Animation framework, and helps to get you through some of the less intuitive parts. It quickly walks you through a few different examples of developing animation apps for the mac and then explains the differences and limitations of writing for the iPhone. I would also suggest reading through the apple docs which will help you understand some of the other tools available to you and also read more details on what you are working with.

Its a quick read, coming in at only 200 pages, and a lot of those pages are full-page images. Personally, I was hoping for a more thorough review and examples for the iPhone, and was dissapointed that there are only like 14 pages in the iPhone chapter, and 7 of them are a full page of a single image. (I think that might have something to do with the time the book was written and the state of the NDA for iPhone developers, but still I was disappointed).  You can get the pdf directly from the PragmaticProgrammers site, but you might want to check Amazon too.

Overall, I think the book gives a decent start to some animation concepts, and ways to improve your iPhone apps, but you might want to hold off on getting it now, and work your way through the existing docs and other sites first. I suspect the next generation of docs on this topic will have a much deeper review and will be worth the wait.

Now I’m looking for something that can give me a good overview of using OpenGL for the iPhone or something like Blender or Unity3d.

iPhone SDK: Testing UIApplicationDelegate with OCMock

iPhone in Dock
As I have discussed earlier, you can go very, very far in unit testing your view controllers using the following recipe, without the need to bend over backwards or employ any mocking frameworks:

  1. Initialize the view controller in your setup using initWithNibName:bundle:.
  2. Force the view to initialize by invoking the controller's loadView method within your setUp method.
  3. Write tests to assert dependencies or behavior.

This works well enough for view controllers, but when it comes time to test your application delegate, this simple approach can begin to break down. Unlike UIViewController, your application delegate is only initialized as a by-product of loading the NIB. Thus, to get this code under test I find OCMock particularly useful.

I show an example unit test below, and discuss how I approached the problem..

Continue reading »

iPhone SDK: Cache Policy & Cookie Handling in NSURLRequest

I recently ran into an issue building an app which hit an existing (protected) website. Passing credentials along with each request, responses at first appeared to be cached, even after the user credentials changed from within the iPhone app. In sorting through this issue, it gave me a chance to get a bit more familiar with NSURLRequest, and NSURLRequestCachePolicy. As I later found, however, my problem turned out to be cookie-related..

Continue reading »

Topics: , ,

PureMVC, Spanning the Platform Spectrum?

PureMVCAt Pathfinder we do a fair amount of desktop style development -- iPhone/Cocoa, WebForms, Swing -- and web application development -- Grails, Rails, JSP, ASP.NET, etc., etc.. In the last two years we, like a lot of other software development shops, have experienced a convergence in our efforts. The web is coming to the desktop in the form of Air and the Desktop is coming to the web in the form of RIA's. Now web MVC, which used to be a pretty benign pattern mostly concerned with app flow and validation, is starting to resemble desktop MVC, which has to deal with document-centric models and long lived views and all of the plumbing that requires.

So we recently had a powwow between all the different parties to talk about MVC and this convergence. With the exception of the insufferable Mac and iPhone developers and their disgustingly mature Cocoa framework, we all agreed it would be nice to have an application level MVC framework for each platform. We also agreed that Swing is a great example of what happens when the vendor doesn't provide such a thing -- spaghetti code that relies on component level MVC and hard wiring at the application level. There are a few MVC frameworks for Swing, such as TikeSwing and Spring Rich Client (soon to be superseded by Spring Desktop), but for every Swing app that has this sort of design, there are hundreds that are just a mess.
Continue reading »

iPhone: Using Pre-processor Directives for Device Testing

iPhone in Dock
Updated. (see comments below)

There may be cases where a certain setting needs to be tweaked based on whether you test on the device or simulator. It took me a while to find the pre-processor directive to detect whether or not the current build targets the iPhone device or the simulator, but with a bit of searching through the GTM code, I found everything I needed in "TargetConditionals.h". An obvious place, in retrospect, but I wasn't able to find this information easily elsewhere on the web, so I mention it here in case you find it useful.

Here's an example of how I've used it:

#if TARGET_CPU_ARM
#if TARGET_IPHONE_SIMULATOR
	// Device will hit external server over cell network
	NSString const *ROOT_URL = @"http://www.external-site.com";
#else
	// Simulator will hit local server over LAN
	NSString const *ROOT_URL = @"http://localhost:8667";
#endif

This kind of tweaking is particularly important when the device itself can not participate on the local network, but needs to access some kind of external environment (or proxy server). Conversely, targeting the simulator to use a local 'development' server is often faster when deploying and debugging issues in your application, particularly if you are developing the server component in tandem.

Another example involved certain audio playback features which work fine on the device, but run into hiccups running on the simulator. Since in this case the functionality is not critical to test, I ignore it in the simulator.

Topics: , ,

Subtle OpenGL Projection Matrix Difference Between iPhone Simulator and Device

iPhone in Dock

If you are deploying to the iPhone simulator instead of to a device, you can get away with not loading the identity matrix for the projection matrix so long as you do not want to draw over any bound textures which are drawn.  However, on an iPhone device, you will notice some serious artifacting if you attempt this.  The artifacts will be related to the last drawn textures, even if they were drawn from a different application (except if the phone was turned off in the interim, in which case you will get a black strobe effect).

This implies that the simulator loads the identity matrix automatically for GL_PROJECTION when loading your application, where as the iPhone itself will maintain the matrix's state between applications.

Topics: ,

iPhone SDK: Testing with TextMate & GTM

iPhone in Dock

Developing in Xcode, I keep my project default "SDKROOT" and Target set to the default for the iPhone device and 'Release', respectively.

That said, I have been trying out TextMate as an alternative to Xcode, thanks to all of the great things TextMate provides (I won't go into all that here, since there are already many great resources on the web). For those iPhone developers who are new to the Mac platform, or to TextMate for that matter, here's a quick tip (and be sure to check install Xcode bundle first).

First, as always, an obligatory shout-out to Google Toolbox for Mac. I am testing my code with GTM, and set the following environment variables so that Xcode plugin for TextMate could run a build / tests accordingly.

  TM_BUILDSTYLE = "Debug"
  TM_TARGET = "Test SDKROOT=Test SDKROOT=iphonesimulator2.1"

This presumes you followed the GTM directions by creating a 'Test' target to run your tests, and also that you are targeting the 2.1 version of the iPhone simulator's firmware. Replace that last argument with 'iphonesimulator2.2' if you are targeting the recently released 2.2 firmware.

With these two settings, everything works great. I can write a bit of code, and run the build. Xcode definitely does a lot, and has its place in development, but I feel that the ease of use in TextMate outweighs the code completion of editing files in Xcode in cases where the code that I am working with is familiar to me.

Wherever I am working with new API's or need to constantly refer to documentation, Xcode is still worth it, particularly after you map some essential keyboard shortcuts (but that's another post). For familiar API's however, you can't beat the productivity gains of just coding in TextMate.

iPhone SDK: UIViewController Testing & TDD

iPhone in Dock

Unfortunately there are not enough examples out there on how to test view controllers with the iPhone SDK. My hope is to remedy that a bit by sharing some techniques I have been using to tackle the problem, particularly in keeping with the spirit of TDD along the way.

First, If you have not already done so, configure your project to use GTM. This is a bit of a no-brainer as it currently stands. Until Apple comes up with something better, GTM is the way to go. It works as advertised, and is a credit to the folks at Google for providing this toolkit.

Now then, many tutorials on the web seem to imply that one should test somewhere in the middle by suggesting to add a few outlets to your controller, fire up IB and wire up your view to your view controller before you even start to think about testing any of it.

Testing controller logic means working under the assumption that you have wired up your view components correctly to match the controller's actions and outlets. Wire up an element to the wrong action (or worse, forget to wire it up at all) and you can easily learn to rely too heavily on manual testing. While this might be acceptable for small one-off applications, within a team of developers practicing collective code ownership, this kind of error can cost real money over time. "Thanks for caring, but I'd rather have a unit test."

Now then, let's take a look at some code!

Continue reading »

8 Tips & Tricks When Starting Objective-C iPhone Apps: [self.paradigm shiftFrom:@"ruby" to:@"objective-c"];

All languages have something interesting to teach us about the art of programming -- and as a Ruby developer almost exclusively, I've always been afraid of strongly typed languages like Java and C++, or the great-grand-daddy of them all, C. So when I decided to tackle Cocoa to work on iPhone apps I went in somewhat leery of how I'd have to change, but hopeful that I'd become a better, more versatile programmer. After a few weeks I would say I've achieved my goal, but it's certainly taken a lot of blood, sweat, and tears to get here.

I think a lot of people are in a similar position to me: trying to pick up Objective-C to do iPhone programming, and coming in with only a book or two as their guide. Most of the books out there for learning Cocoa and the iPhone SDK are very good but there are a lot of gotchas and stylistic tricks that really mean the difference between comprehending a statement and staring at it in horror and confusion until Google comes to your rescue. The aim of this blog post is to come to your rescue instead of Google. These are the 8 biggest foul-ups that I wish I had known before I started learning Objective-C. Hopefully you'll learn something here that will prevent you from making an idiotic mistake I already made.

Continue reading »

Topics: ,

Will Q4 iPhone Sales Surpass Expectations?

I went to the AT&T store on Friday to buy another testing phone for our developers, who are busily churning out more iPhone applications, and to switch one of my cell lines over from T-Mobile to my iPhone.  It was an interesting experience, with T-Mobile's very friendly and courteous customer service reps pitching me strongly on the G phone, and my service getting switched over in the middle of a business call.  I asked the AT&T store manager what percentage of their sales were iPhones, and after a bit of thought, he said about 65%.

Granted, that's only one location, but based on all of the annecdotal evidence I have, as well as how well the T-Mobile folks were trained to deal with the iPhone switch (not only on my request, but on my wife's similar call last week) I am expecting some pretty strong numbers form Apple tomorrow.

I'm also expecting decent G phone numbers for Q4, but I'm not sure how well they'll hold up later.

Update: It looks like Apple's Q4 iPhone sales topped 6.9 million, about 800,000 units more than RIM's 6.1 million in the equivalent period, beating most analyst expectations by a mile.

Interesting discussion on this over at Daring Fireball (of course) as well as a piece on Fortune on traditional analysts versus bloggers on Apple sales and earnings.  The bloggers got the iPhone numbers better than the analysts, but everyone missed on mac sales.

Topics: , ,

About Pathfinder

Follow the Blog

    Get a monthly update on best practices for delivering successful software.

    Subscribe via email

      

    Subscribe via RSS      RSS icon

Topics

Search

WordPress

Comments about this site: info@pathf.com