Matt Galloway

My home on the 'net.

Facebook World Hack London - Winners!

On Friday (21st September 2012), myself and 4 friends attended the Facebook World Hack day in London. It was held in the London offices of Facebook and around 200 people attended. Twilio, Pusher and Deezer were also there. The aim was to build something which used the Facebook APIs, with extra points going to teams who incorporated the OpenGraph, a game element or used one of the 3 other companies APIs.

So myself, Michael, Chris, Will and Stevo set about working on the basic idea we had gone to the day with. The idea was called “Flash Dance” and it was to be an app that allowed you to arrange silent discos in a flash mob kind of way.

And so, Flash Dance was born…

Flash Dance Icon

iOS 6 by Tutorials

For the past few months (since WWDC) I’ve been co-authoring a fantastic book called iOS 6 by Tutorials. And today I can announce that we have finally been able to release it now that Apple’s iOS 6 NDA has been released!

iOS 6 by Tutorials

Hacking up an armv7s library

NOTE: Please take care with this. I obviously cannot test if this will actually work on a new iPhone 5 device! I provide no warranty if you submit having used this and it doesn’t actually work on the new device. Please think twice before submitting an app which you have used this method to create. You don’t have to submit an armv7s binary. Just set your “Architectures” build setting to armv7 only and submit the resulting binary.

UPDATE: It worked! I tested an app that I’d used this method to build an armv7s slice with. It ran fine on my iPhone 5 :-D.

Well the iPhone 5 has been announced and it just so happens that the architecture it uses is what they’re calling armv7s. This brings in yet another architecture to the mix alongside armv6 and armv7. And I bet you are wondering why you’re getting linker errors when building for armv7s when using external libraries. It’s because those external libraries do not have armv7s versions!

If you run file on the library then you’ll see that there is no armv7s version. For example:

$ file libUAirship-1.2.1.a
libUAirship-1.2.1.a: Mach-O universal binary with 3 architectures
libUAirship-1.2.1.a (for architecture armv7):    current ar archive random library
libUAirship-1.2.1.a (for architecture armv6):    current ar archive random library
libUAirship-1.2.1.a (for architecture i386): current ar archive random library

So what can you do? You could wait for the library to be updated, or you could just follow these steps…

Auto-sorted arrays

A problem came up whilst I was hard at work at my current job (iOS developer at zeebox) where I needed a list of things that were going to be displayed in a table. These things were going to be ordered based on time but the API I wanted my table view to have was such that it would be given a chunk of new items to display but it didn’t necessarily know where to display them. I would want to animate the changes to the table so when adding a new object I’d need to know where they had been added. So I thought to myself:

Wouldn’t it be nice to have an array which kept itself sorted when you added objects to it and also told you where it had added them?

And this is where MJGMutableSortedArray was born…

Moved to Octopress

I have been wondering for a while now about what I should do with my iPhone apps blog. It gets a fair amount of hits at around 5,500 uniques per month which I consider to be fairly good considering I don’t update it any where near as much as I should. I write for the site when I get a chance and mostly it’s just little bits of information I’ve picked up along the way when developing apps, and also there’s a few tutorials which seem to go down well.

But I needed to do something with the site as it was looking very tired and runs on Wordpress so has a dependency on a database when mostly the content is static. Enter Octopress.

A look under ARC’s hood - Episode 4

The next episode of my deep clambering into the underbelly of ARC starts from this Tweet by @steipete where he says “With ARC, I now find myself typing “new” for dumb model objects. Yay or Nay?“. It got me thinking. He’s totally right that with ARC we can now just use [SomeClass new] and let ARC handle all the memory management for us. Previously we’d often create a convenience class method on SomeClass which would return an object autoreleased so that it made the calling code clean and easy to understand the memory management. Now with ARC we don’t need to do that and I wondered what would be the benefit of using new over alloc + init over using our old friends, the convenience class methods. This blog post tells that story.

A look under ARC’s hood – Episode 3

This instalment of “A look under ARC’s hood” is all about the new @autoreleasepool directive. LLVM tells us that the semantics of autorelease pools has changed with LLVM 3.0 and in particular, I thought it might be interesting to see what ARC is doing when it comes to these.

UIImageOrientation / EXIF orientation sample images

Whilst I was doing some work with images recently I was in desperate need for some sample images which were tagged with the EXIF orientation flag for each of the 8 orientations which are supported by UIImage in its UIImageOrientation metadata. I couldn’t find any already out there, so I made my own. And now I’m posting them here for anyone who might also find this useful. I now have these saved on my iPhone and use them in apps as test images.