Text

Introducing UAGithubEngine

Thinking of building Mac or iOS apps for the Github API? I have something that may interest you. Introducing UAGithubEngine, an almost-complete Objective-C wrapper round the Github API.

UAGithubEngine is compatible with Mac OS X 10.5 and above and iOS 4.0 and above, and implements the complete API, with the exception of the network graph and Gist sections. Manage users, watch repositories, file issues and more, all with a robust, clear and simple implementation built specifically for Apple platforms.

How easy is it to get started? Exceedingly.

Just add the engine files to your project, instantiate an instance of the engine class, and away you go! Now you’re free to enjoy the ease of accessing the Github API using native objects like NSDictionarys, NSDates and NSStrings, with familiar Cocoa design patterns you know and love.

UAGithubEngine *engine = [[UAGithubEngine alloc] initWithUsername:@"auser" apiKey:@"akey" delegate:self];
[engine getUser:@"owainhunt"];
[engine addComment:@"Awesomeness." toIssue:@"owainhunt/UAGithubEngine/1"];

That’s all there is to it.

Want a closer look? Grab the source code from Github and give it a whirl.

The structure - and code - of UAGithubEngine is heavily influenced by Matt Gemmell’s MGTwitterEngine.

Update: As Github have deprecated passing username and API key as parameters to the API URL, UAGithubEngine has now been updated to use basic HTTP authentication as recommended. As a bonus, this means you can now authenticate using your password instead of your API key.

Text

Core Data Migration and Versioning

Yep, another Core Data post. Hat tip to Jeff LaMarche for the solution on this one.

After adding a new data model version, then moving some furniture around and adding a few new bits and bobs, I hit Build & Go and was hit with the fantastically detailed error:

Can't merge models with two different entities named 'SuckItBiatch'

Head on over to Jeff’s post for the full explanation of what’s going on here but to cut a long story short, there’s an issue with how the .momd bundle works in tandem with Apple’s template code.

Replace the standard -managedObjectModel method with the following, and as long as all other prerequisite pieces are in order you should be fine.

- (NSManagedObjectModel *)managedObjectModel {
    
    if (managedObjectModel != nil) {
        return managedObjectModel;
    }
    
    NSString *path = [[NSBundle mainBundle] pathForResource:@"YourAppName" ofType:@"momd"];
    NSURL *momURL = [NSURL fileURLWithPath:path];
    managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:momURL];
       
    return managedObjectModel;
}