AFNetworking: a well managed open source project

Last week, I talked about Networking using NSURLConnection. In a future post, I’m going to talk about how to use AFNetworking. But first, I wanted to talk about why you should trust AFNetworking as a project in your project.

I haven’t been using github for long. That said, AFNetworking is the best-managed git project I’ve seen. It’s being managed so well that I wanted to write about it. In doing so, I’m not trying to praise Mattt Thompson’s efforts. It will probably come across that way, and he deserves it. Instead, I want to say that if you plan to maintain a git project, you should handle it as well as Mattt does.

Continue reading “AFNetworking: a well managed open source project”

Using blocks to handle errors

In the past, I’ve talked about Using blocks to remove redundancy. But now I want to explain the pattern I’ve adopted since, which is my favorite block pattern of all. Even though it, too, is all about removing redundancy: handling errors.

Although Objective-C supports exceptions, they’re not commonly used. A thrown exception is usually not caught, making it a fatal error.

Continue reading “Using blocks to handle errors”

Networking using NSURLConnection

In a previous article, I mentioned how to handle 302/303 redirects to web services. But that’s a fairly advanced topic, and we should have built up to that.

What I’m going to cover:

  • The basics of networking using NSURLConnection, part of Apple’s Foundation framework.

What I’m not going to cover:

  • How to determine if a connection is available before trying a request. (Hint: Don’t.)
  • How to retry an operation when a connection becomes available. (Hint: Reachability.)
  • How to abstract this without losing anything important, and bring it all under control. (Hint: Use AFNetworking.)

Continue reading “Networking using NSURLConnection”

Use a Build Phase to validate XML

My application includes some XML files that are used while running to map data from a web service. This has drastically simplified the code I needed to write to parse data from the web service, since I can describe how to decode all of the types of object the web service interacts with simply.

If I accidentally provide bad XML, I don’t know until my app tries to parse it. That may be some time into its run. If the XML is processed because of a specific user action, I’ve broken that specific user action. So we’re going to build a build phase to validate the XML.

Continue reading “Use a Build Phase to validate XML”

Creativity is not a product of thinking

Who I am is the sum of many parts. More than my mind wants me to believe. There’s a part of me that’s capable of problem solving, of creativity, of insight.

My mind is the part of me that questions things. It’s my inner critic. It does most of the talking in my head. Mostly, it tells me that I can’t do something. This is hard. That’s wrong. You’ve got nothing new to add to this. This is not how I solve problems, though it drives me to find better solutions to problems.

Continue reading “Creativity is not a product of thinking”

I’ve changed my mind about Xcode snapshots

In the recent past, I’ve mocked Xcode’s snapshots. They were sluggish and not especially reliable. I’d like to say they were inefficient, too, but the truth is that they were so slow and so unreliable I never bothered to find out.

Recent versions of Xcode have been a lot better. I’m not sure when archives really improved, but in the most recent build of Xcode archive takes only a split second. So far, they seem reliable. And they work by storing the source in a private git repository, so they’re pretty efficient, too. This does not affect your real git repository, even if you’re using git. This is entirely separate, deep in Xcode’s private directory tree deep in your home folder.

Continue reading “I’ve changed my mind about Xcode snapshots”

How the iPhone GPS differs from a standalone navigation GPS

All models of iPhone since the 3G, as well as the iPad 3G and iPad 2 3G, include Assisted GPS (AGPS).

I’ve heard that this isn’t real GPS or that it’s somehow inferior to real GPS. AGPS is actually superior to “real” GPS. However, there are ways the iPhone is also inferior to a standalone navigational GPS like a Garmin or Tom Tom. I’m going to explain the differences between them.

Continue reading “How the iPhone GPS differs from a standalone navigation GPS”