When you start using Grand Central Dispatch or NSOperation, you’ll want to perform some actions on the main thread and some intentionally off the main thread. This is a simple and obvious technique, but it took me a while to adopt it: You can do by asserting with NSAssert or NSCAssert for [NSThread isMainThread], just… Continue reading Check your thread
Assertions are a great tool. As an Objective-C programmer, I use NSAssert and NSCAssert liberally. For various reasons, you sometimes can’t use NSAssert in a block easily. I’m going to explain why and describe a new macro, BlockAssert, which solves this.
If you have an open source library that requires Automatic Reference Counting (ARC), you may have issues with your users trying to build it without ARC turned on. Luckily, it’s pretty simple to enforce ARC. I’m going to discuss how to do so, and why it’s a good idea.
Which modern Objective-C feature can you use where? Check the Objective-C Feature Availability Index (via 0xced).
In the past, I’ve tried to avoid using ADC incidents. You get two a year per program, and most years I’ve avoided using any. This year, I decided to use them both the iOS ones up before renewing.
If you’re downloading a file with widely-recognized lossy compression, your user’s cellular provider may interfere with it. This has always been true of internet connections; I first ran into this with dialup years ago. But it went away for a while with broadband, is back with wireless. The simplest example is a JPEG. You may… Continue reading Wireless proxies may re-compress your files
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… Continue reading AFNetworking: a well managed open source project
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… Continue reading Using blocks to handle errors
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… Continue reading Networking using NSURLConnection
If you’re an application developer: Yes, you should use Automatic Reference Counting (ARC).