Asynchronous methods are the key to keeping your iOS app responsive. Each method running on the main thread has 1/60 of a second to return before it will affect your screen refresh rate. For long-running operations, the typical paradigm is to execute your code on a separate thread (via an abstraction such as dispatch_queue_t or NSOperationQueue), and when it completes, to invoke a completion handler on the main thread. That way the main thread is available to process touch inputs or render UI elements.
Category Archives: iOS
iOS 8 finally launched on September 17, and with it, the public release of Xcode 6. However, after upgrading you will notice that you can no longer compile using the iOS 7.1 base SDK. This is a problem for any app that isn’t yet compatible with the iOS 8 SDK. To see what SDK’s you have installed, open the Terminal app on your Mac and enter:
The jaws of iOS developers everywhere dropped with the announcement at WWDC yesterday that Apple was introducing a new programming language to eventually replace Objective-C, called Swift. The surprise wasn’t that they did it (everyone knew it had to be done), but that it happened so soon. Apple has so much institutional knowledge of Objective-C that to replace it is truly a massive sea change. The problem with Objective-C, being a 25-year old mashup of C and Smalltalk, is that is was never quite fully-baked. And it was not suited for high-performance code, causing developers to revert to C or C++ in many cases. Here are my initial thoughts and observations on how Swift compares to Objective-C and other modern languages. There’s a LOT to cover, so I just picked out the interesting bits:
Parse is a popular backend-as-a-service (BaaS) that essentially gives developers a virtual database and app server in the cloud. You can create a “cloud code endpoint” with a unique name that accepts any number of parameters. This endpoint can then be invoked by the mobile SDK, and a response returned. This response can consist of any number of data objects. For standard database queries, this SDK comes with an additional powerful feature: client-side caching. However, the Parse mobile SDK does not provide caching functionality for cloud functions.
One of things that surprised me in iOS is the lack of an open-source native library to connect to Microsoft SQL Server. When googling the topic the usual comments are “why would you do that?” and “just use a web service wrapper.” Well, there are countless business reasons to access a SQL Server on a LAN: POS, data collection, reporting, etc. Further, it’s not always possible or practical to install a web service layer (REST, SOAP, OData) to act as an intermediary. Granted, it is generally much safer to do so, but it does add a layer of complexity (and latency).
Xcode provides two places to keep track of your app’s revisions: version and build. To see them, click on your Project name in the Navigator, and then click on your main build target under Targets. Click on the General tab. In this post I’ll show you how to automatically update your build numbers with every release build! First, an overview.
Good code should be self-documenting, but sometimes you also need to generate external documentation for reference purposes. In this post I’ll show you how to use two open-source tools and a build script to create beautiful, Apple-style HTML documentation files in Xcode. I’ll also show you how to create docsets for Xcode so that your class references show up right along side Apple’s! It will be a seamless and dare I say, enjoyable, process for generating documentation.