Under The BridgeUnder The Bridge

ARM Architecture

Here’s another should-read for you all from the fellow who did the introduction to ARM® NEON™ we mentioned earlier:

A few things iOS developers ought to know about the ARM architecture

Note particularly this bit if you did read the previous article and apply it:

If you’ve read my NEON post, you may remember that in that post I also suggested a way to do the detection and selection at runtime. If you check now, you’ll notice I have actually removed that part, and now recommend you do not use that method any more…

But that aside, the most important part (in case you haven’t run across it yet) is Thumb desirability variances:

… ARMv6 Thumb code has access to fewer registers, does not have conditional instructions, and in particular cannot use the floating-point hardware. This means for every single floating-point addition, subtraction, multiplication, etc., floating-point Thumb code must call a system function to do it. Yes, this is as slow as it sounds. For this reason, I recommend disabling Thumb mode when targeting ARMv6…

… When targeting ARMv7, however, all these drawbacks disappear: ARMv7 contains Thumb-2, an extension of the Thumb instruction set which adds support for conditional execution and 32-bit Thumb instructions that allow access to all ARM registers as well as hardware floating-point and NEON. It’s pretty much a free reduction in code size, so it should be left on…

The way that we’ve handled this is that our base .xcconfig file for a universal project compiling with 4.0+ SDK now contains



GCC_THUMB_SUPPORT[arch=armv6] = NO

Haven’t actually verified with a built executable that indeed those do the right thing, mind you, but it makes the Inspector panel in Xcode look like it’s set up properly, and various combinations of iPhone/iPad targeting projects seem to run ok. Of course, if you have any corrections or elucidations, please share!
h/t: iPhone Development!

Multitasking Delegation

No doubt you’ve noticed updating your old apps that if you don’t just throw up your hands in disgust and do away with it, there’s a surprising deal of complexity sorting out what to do with everything you’d stuffed in -didFinishLaunching and -applicationWillTerminate. How much complexity? Well, courtesy of Dr. Touch, this much complexity:


Yipes! Even if you’re pretty sure you have a handle on things, worth reading through anyway. But beware that there is one inaccuracy, to be found here:

There are only two scenarios left where your app’s applicationWillTerminate: will actually be called: if it’s build with an SDK of less than version 4.0 or if you chose to opt out of backgrounding by adding the UIApplicationExitsOnSuspend key to your info.plist.

There are actually three: running your app under 4.0 on an iPhone 3G or whatever iPod version(s?) it is that don’t allow multitasking, you will get that call as well. So “hardware can multitask” should be a decision immediately under the “SDK >= 4” decision. Other than that little quibble, good reference!

Business Models

And now, we present to you the comic relief interlude of your humble servant’s perpetual pageant of perspicacious posts:

How to make money with Android – business models

Ha! A friendly jape at our dear Android-loving friends, there. We kid, we kid. We don’t actually have any Android-loving friends. Oh dear, this really isn’t going quite right, is it. OK, deep breath, straight face…

Alright, all self-indulgent chuckling at the ingenuousness of conjoining “make money” and “Android” aside, this actually is a pretty darn solid series of posts that with appropriate buzzword substitutions are completely applicable to iOS as well, and probably there’s at least something in there to rouse some pecuniary rumination:

40 Android Business Models, Part One

40 Android Business Models, Part Two

40 Android Business Models, Part Three

40 Android Business Models, Part Four

40 Android Business Models, Part Five

40 Android Business Models, Part Six

Personally, better than two years into this iPhone thing, we’ve only explored #29 so far … that leaves quite a few to try yet!

Custom Alerts

So you need to put up something kinda sorta like an alert but custom and having a spot of trouble getting it quite right? Here’s a variety of approaches you may find of use:

UIProgressHUD replacement

A dropin replacement for the named private API, for a translucent black HUD spinner please wait type display.

Implementing a Wait “Alert”…

Another approach to imitating the private API, with some animation tips. Also note the sequel Tic-Tac-Toe Update post to imitate the GameKit peer picker.

Showing a “Loading…” message over the iPhone keyboard

How to find the keyboard view, if you want to dance on the edge of undocumented functionality.

Announcing DSActivityView

Another take on the progress displaying task.


And yet another.

And if what you’re looking for isn’t just a HUD replacement but a full on UIAlertView replacement but with being able to add edit fields and stuff with hokey workarounds or questionable API calls, here you go:

Custom Alert Views

Should be enough in all that to sort out pretty much any alert-type functionality you have in mind; but as always, Dear Reader, if you have anything relevant we’ve missed, please comment!


SVProgressHUD is reputedly a simpler and prettier MBProgressHUD alternative.

… and SVStatusHUD its cousin for orientation/volume change type HUDs.


So chances are you’ve had to work with some social services such as Twitter and Facebook already; but how about one library that provides

  • Delicious
  • Email
  • Facebook
  • Google Reader
  • Instapaper
  • Pinboard
  • Read It Later
  • Tumblr
  • Twitter

for images, URLs, text and files; allows offline queuing; and is MIT-licensed open source? Sounds pretty appealing, yes?

ShareKit: Drop-in Share Features for all iOS Apps

Well there you go then. From the introduction:

For developers, adding sharing features to an app is a source of dread. It takes a LOT of work for each service that you add. You have to learn each service’s API, probably learn OAuth, design and build UI to handle all the interactions of logging in and collecting information, and write code to make requests and handle all possible errors. You have to do this for every service and every service has a unique API. It makes it very difficult to add all of the services your users request.

In the iOS SDK we have access to MFMailComposeViewController. This is an Apple provided view that lets apps present an email dialog to the user. You feed it some starting values like a subject line and body content and it pops over your existing application, lets the user do their thing and goes away when they are done.

This is what I wanted in my apps. I wanted the same controller but for Twitter, Delicious, Evernote, and everything else. That’s what ShareKit is.

Yes, that certainly does look top of the list to check out for your next instance of social sharing needs, indeed!

h/t: iOS Development Goodies via ManiacDev!


SimpleAuth is a nice-looking alternative to ShareKit for the use case of simply wanting to authenticate users via their social accounts.


So you know that thing Tweetie.app, er Twitter.app, does where you swipe a table cell and get a bunch of commands revealed behind it? Feel like doing that in your app? Here you go, TGNWSwipeableTableView shows you how!

And reputedly, even better than the original — “fixes a problem Tweetie has, where you can’t swipe over the same row two times consecutively.”

Not too sure what we think of this as an interface feature in general, but if you do have lots of item-dependent contextual commands, it’s probably about as good as anything else one can come up with on an iPhone sized screen…

h/t: iOS Development Goodies!


We’ve mentioned various OpenAL helpers before, but here’s a new one that looks like a winner: ObjectAL for iPhone! From the most excellent documentation at the github wiki,


  • ObjectAL gives you full access to the OpenAL system without the hassle of the C API. All OpenAL operations can be performed using first class objects and properties, without needing to muddle around with arrays of data, maintain IDs, or pass around pointers to basic types.
  • BackgroundAudio provides a simpler interface to AVAudioPlayer, allowing you to play, stop, pause, and mute background music tracks. As well, it provides an easy way to configure how AVAudioPlayer will handle iPod-style music playing and the silent switch.
  • IphoneAudioSupport provides support functionality for audio in iPhone, including automatic interrupt handling and audio data loading routines.
  • SimpleIphoneAudio layers on top of the other three, providing an even simpler interface for playing background music and sound effects.

Naturally, just earlier today we shipped off an OpenAL-using project … but the next one, we’ll definitely be checking this out!

h/t: iDevGames via ManiacDev!


From the prolifically open sourcing Matt Legend Gemmell, here’s MGImageUtilities, some useful UIImage categories for your iPhone development:


This category lets you resize an arbitrary image to fit into a specified physical size, using one of four resizing methods:

  • Scale: scales the image proportionally to fit entirely into the required size, like UIViewContentModeScaleAspectFit.
  • Crop: scales the image proportionally to completely fill the required size, cropping towards its center. This is the most useful method, and works like UIViewContentModeScaleAspectFill.
  • Start: as for Crop, but crops towards the “start” of the image (the top or left, depending on relative aspect ratios).
  • End: as for Crop, but crops towards the “end” of the image (the bottom or right, depending on relative aspect ratios).


This category takes an image (presumably flat and solid-coloured, like a toolbar icon), and fills its non-transparent pixels with a given colour. You can optionally also specify a fractional opacity at which to composite the original image over the colour-filled region, to give a tinting effect.

Source is on github, enjoy!


Here’s a nice looking piece of code to help you out with that next great RTS game you’re planning on writing for the iPhone; from the same dude responsible for the awesome ASIHTTPRequest, it’s ASIPathFinder!

What is ASIPathFinder?

ASIPathFinder is a complete implementation of a cooperative path finding algorithm, and will probably be most useful for writing Real Time Strategy games. It is written in Objective-C, and is compatible with Mac OS and iPhone OS.

What is a co-operative path finder?


A co-operative path finder allows multiple objects to find a path on a map, planning ahead to alert other objects of where they’re going to travel. This means that an object can avoid other objects ahead of time, before they collide.

If you’d rather just see it in action, why yes there is an app for that:

ASIPathFinder is based on code I originally wrote for my Space Harvest game for iPod Touch and iPhone. Download the game to get a feel for its capabilities.


So there you go, BSD-licensed and everything, documentation here and project on github!


Introduction to A* Pathfinding

Introduction to A*

A* on Triangulated Spaces: Part 1 and Part 2

How To Implement A* Pathfinding with Swift

UI Automation

Here is a great walkthrough of how to get started with UI Automation that new UI scripting test goodness you may have noticed in the latest SDK, in between trying to get all your previous projects up to speed, if you’re anything like us:

In this post we’re going to look at the UI Automation library/tool that Apple added to iOS SDK 4.0. This is a huge step forward for test automation on the iOS platform. While it’s not without some compromises, it’s worth looking at to see if you can reduce the time you spend on manual testing.

UI Automation is both a probe for Instruments as well as a JavaScript library provided by Apple to exercise and validate a running application. In this case, “running application” isn’t restricted to the simulator—you can also automate the application on a real device. To my knowledge, this is the first time I’ve heard of anyone being able to do this.

This is huge. Having the ability to automate workflows in your application yields two benefits: you cut down on manual testing which saves you time, and you can rely less on your memory to execute all your tests. Instead, you just push a button (okay, two or three buttons) and run your full regression suite. Have I piqued your interest yet?

Excellent stuff!


And check out the post-mortem post, More UIAutomation!

Stress Testing And Hands-Free Screenshots With UI Automation introduces