How to Create a Synchronous Wrapper Around an Asynchronous Method

Wrapper 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.

Continue reading

How to Get Back the iOS 7 SDK After Upgrading to Xcode 6

Seven

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:

Continue reading

An Overview of Apple’s Swift Programming Language

Screen-Shot-2014-06-03-at-6.47.25-am-730x450

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:
Continue reading

How to Get Back the iOS 6 SDK After Upgrading to Xcode 5

iOS 7 finally launched on September 18, and with it, the public release of Xcode 5. However, after upgrading you will notice that you can no longer compile using the iOS 6.1 base SDK. This is a problem for any app that isn’t yet compatible with the iOS 7 SDK. To see what SDK’s you have installed, open the Terminal app on your Mac and enter:

ls /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs

If you only see the iOS7 SDK folder listed, you will need to extract the iOS6 SDK folder from an old copy of Xcode 4.6. Or you can just download it here. Copy your extracted iPhoneOS6.1.sdk folder into the folder shown above. Shut down and restart Xcode. You will then be able to select from both SDK’s when building or running.

If you just need to download the iOS 6 simulator, open Xcode and go to Xcode > Preferences > Downloads.

Hands-On: Building iOS and Android Apps with C#

Hands On with Xamarin

Last night I attended a great .NET Mobile Developer meet up at Microsoft’s NYC offices entitled “Hands-On: Building iOS and Android Apps with C#“. It was hosted by Greg Shackles, author of “Mobile Development using C#“. Greg also presented at Xamarin’s Evolve conference in Austin, TX this past April. At this meetup he conducted a hands-on demo on how to build a simple iOS and Android app using Xamarin Studio and C#.

Continue reading

iOS Training: Your Second iOS App

iOS Training - Your Second iOS App

Yesterday I conducted my second after-work training session at IIN for developers looking to learn XCode and Objective-C. Everybody walked out of there with a working Note Taker app! Here’s what we covered:

  • Table views and UITableViewController
  • UITableViewDataSource protocol
  • Prototype cells
  • NSMutableArrays
  • UINavigationController
  • Segues
  • Delegates
  • Reading and writing to NSUserDefaults

Thanks to those who came! Next week I’ll do a repeat of this week’s session for those who couldn’t make it. After that, we’ll keep working on the Note Taker app to delete and reorder rows, and using model objects to store our data. See you then!

iOS Training: Your First iOS App

Your First iOS App

Last night I conducted an after-work training session at IIN for developers looking to learn XCode and Objective-C. I’m happy to say that everybody walked out of there with a working Tip Calculator app! Topics covered:

  • Creating a new Github repository
  • Connecting XCode to Github
  • XCode overview
  • Utility App template
  • Storyboards
  • Connecting IBOutlets and IBActions
  • Basic protocols and delegates
  • Converting strings to numbers and vice versa
  • Formatting currency

Thanks everyone for coming! Looking forward to the next session…