It’s September 16th on the East Coast, and SlapHappy!™ is now live in the US app store. I don’t know about other countries, yet, but I assume that if it is September 16th somewhere in your country, you can get it now.
To celebrate the launch, SlapHappy!™ is on sale for $.99 for a limited time. Check out the trailer below and get it in the App Store!
2010 is shaping up to be an exciting year for those of us in the iPhone and mobile software business, and there is no better way to kick it off than with a free community event. Free Time Studios is proud to be a major sponsor and primary organizer of the first ever iPhoneDevCamp Houston. If you are in the general vicinity of Houston on the last weekend of January, this is a can’t miss event. There will be presentations for people of all skill levels covering app development and marketing. Whether you are a seasoned or hopeful iPhone developer, there will be something for you at iPhoneDevCamp Houston.
Also, make sure to get your sleep on Friday night because we will be hacking all night Saturday. Show up with your ideas and your laptop, and work with the top iPhone development talent in the Houston area. Caffeine and sustenance will be provided.
Join the all of people who have already registered and sign up here. It’s free.
For my Core Animation presentation at 360idev last year, I created a bunch of sample code to show how simple and powerful Core Animation is. I also promised that I would update the sample code with even more advanced examples. That has not really happened (yet!), and it is time for me to atone.
I am very excited to officially release a collection of utility code that I have accumulated over the past year: FTUtils! It is the first dependency I add to all of my projects, and I have already received enthusiastic feedback from developers who have stumbled on the github project.
It probably comes as no surprise that the bulk of FTUtils contains enhancements and extensions to the Core Animation API (called FTAnimation). I use Core Animation a lot, and I have tried to find elegant ways to round off some of the sharper edges of the API. FTUtils is not only about Core Animation, though. It features:
A category on UIView that puts 13+ canned animations only a method call away.
Access to the CAAnimation objects for the canned animations so you can mix and match them all you want.
Implementation of the target/action pattern for animation delegate callbacks. No more huge animationDidStop:finished: methods!
Simple chaining of an arbitrary number of animations.
Embedding of a pre or post animation delay directly in the CAAnimation object (useful for chaining).
performSelector* methods built for calling delegates that elegantly handle non-existent selectors and allow the passing of primitives as parameters.
Simple methods for reversing arrays.
A collection of macros to make common code patterns simpler to use.
Since I use FTUtils in all of my projects, it is updated regularly with bug fixes and new features. Currently, I am working hard at documenting the whole library at ftutils.com, and I will be pushing updates to the site as I finish chunks of the docs.
The iPhone developer community is an active and friendly one, and it has been very good to me. I am glad to have something to give back. Also, for those of you planning to attend 360idev this April (you should go…really), I will be speaking about advanced uses of Core Animation including an explanation of how everything in FTAnimation works.
One more thing…
Here’s a screencast showing off the canned animations in FTUtils. The code for this app is in the Examples directory of the project.
Continuing our series of Core Data tips and tricks, we turn to error handling. All good developers know that error handling is an essential piece of quality software. Unfortunately for Cocoa developers, error handling can be a little cumbersome and verbose on our favorite platform. This is a small price to pay to be able to work with such outstanding libraries and APIs, but the constant code repetition can eat away at our keyboards. Frustratingly, the errors we work so hard to catch and handle are, sometimes, not useful at first glance. This is definitely the case when saving an NSManagedObjectContext.
The Problem
Early in development, the data model model changes often, and errors are inevitable. Forget to make a new attribute optional, and the code blows up while saving the context. Because I move pretty fast and change things often, this kind of stuff happens to me all the time. Core Data provides me this error message quite often:
Domain=NSCocoaErrorDomain Code=1560 UserInfo=0x14f5480 "Operation could not be completed. (Cocoa error 1560.)"
For the developer inexperienced with Core Data, this is a very disheartening message. It does not give us any indication of what went wrong or how we should attempt to fix the problem.
The Solution
It turns out that, if there is more than one error, Core Data puts an array of NSError objects in the userInfo dictionary with the key NSDetailedErrorsKey. This is not obvious, and it drove me crazy for a while until I turned to Stack Overflow where someone else had already asked my question. There, someone named Charles provided this solution with code to get at the “real” error. Overjoyed, I turned the code into a macro, and I use it exclusively to save a context during development. Here is the macro:
Now, whenever I need to save the context, I can do it safely and comfortably like so:
FT_SAVE_MOC([self managedObjectContext])
This macro only prints the error messages, but all I want during development is error messages in the console. This code can easily be moved to a function or method to do more robust error handling in a production scenario, but that would fill an entire post on its own.