Posts Tagged 'Programming'


This looks like an interesting framework for your web-backed application development — RestKit:

RestKit is an Objective-C framework for iOS that aims to make interacting with RESTful web services simple, fast and fun. It combines a clean, simple HTTP request/response API with a powerful object mapping system that reduces the amount of code you need to write to get stuff done.

Specifically, that means

  • A simple, high level HTTP request / response system.
  • Core Data support.
  • Database Seeding.
  • Framework level support for switching servers & environments (development/production/staging).
  • An object mapping system.
  • Pluggable parsing layer.

Code is on github and there’s a tutorial here — looks like it’s well worth looking into for your next web-centered project!

h/t: @Dylan_Beadle!

… and ManiacDev just posted about it too.


Continuing the above-mentioned tutorial: iOS SDK: Advanced RestKit Development

Continue Reading →

Cloud Syncing

So if you’re doing productivity applications, chances are that sooner or later you’re going to run into the question of how to sync your data files across multiple devices and/or platforms. A particularly good example of a category that finds that a compelling problem is task managers. Here’s a couple posts with worthwhile discourse on the subject:

To Sync or not to Sync

Discusses all the options the Today Todo people considered/observed others using:

  • Do it yourself – ie, Appigo’s Todo built on Moki Mobility.
  • MobileMe
  • Google Calendar
  • Google Docs
  • Evernote
  • File based sync – ie, Omnifocus syncs to MobileMe or a WebDAV folder
  • Dropbox

We’re inclined to think that the advantages of using Dropbox are reasonably compelling here, particularly if you’re resource constrained in your development.

Now, on the other hand, if you’re not particularly constrained by resources, take a read through Cultured Code’s (that’s the Things people) recent thoughts on the same topic:

State of Sync, Part II

… We were so intrigued that we decided to develop a sync solution based on Git’s core ideas. Since these were general ideas anyway, we decided to create a solution that isn’t tied to the specific properties or needs of Things. Instead we wanted to create a general framework that could be integrated with any application no matter what the specific data model or sync policies of this application were.

But we didn’t stop there. If you create something new, knowing that the technology will be needed on multiple platforms, it is worth thinking about a cross platform strategy. We ended up with detailed plans to create a JavaScript-based cross-platform data model framework with Git-inspired sync built in. This strategy required substantial portions of all versions of Things to be rewritten. It was clearly the most ambitious project we ever took on. Dissatisfied with our previous attempts, we didn’t want to settle with anything short of perfection…

Indeed. Well, we certainly encourage people whose tools we rely on ourselves to take that admirable approach. Around here though, “pretty darned good given the time and money constraints” is pretty much the highest possible target, and using Dropbox for sync functionality looks like a good first order approximation to that in most circumstances.

Finally, some more worthwhile comments on the first post here,

Sync with cloud – Today ToDo

First point. Resist ALL temptation to host own service. This will invariably lead to an enormous amount of dissatisfaction with the app itself as even the slightest outage will globally affect the perception of the entire application … At least if using a third party service, the blame can be transferred…

Yes. Yes, indeed.

Continue Reading →

License Scripting

Continuing our recent theme of pulling together Xcode scripting-related notes in preparation for that Xcode 4 upgrade soon, here’s a handy little Ruby script you might wish to take a look at for tips:

An Xcode 3 script which will insert a New BSD License comment at the head of a file. Place the caret at the top of your file (or select an existing header comment) and run the script via the Xcode script menu…

As usual, if you have any comments on changes needed to work with Xcode 4, please let us know!

Continue Reading →

Ad Hoc Redux

So as pointed out in comments on yesterday’s automated build post collection, if you’re thinking about that kind of thing you should be considering what kind of method you’re going to use for ad hoc build distribution; and that’s a good excuse to round up the latest developments on that front since we first noticed wireless options for investigation as well.

Personally, we’ve found no compelling reason to switch from iOS Beta Builder to meet our ad hoc distribution needs so far, and we note that it’s now up to version 1.5 and headed for the App Store; and apparently there’s also some interesting forks,

… There’s a fork with better support for using Dropbox as the storage medium – interesting. There’s also full command line support, helpful for people that want to script the entire build process…

that command line support being particularly interesting, and documented here:

iOS Ad-Hoc Beta publishing directly from Xcode

If you don’t want to use that for some reason, here’s a couple posts on scripting xcrun directly for use with Hudson or whatever:

Automating Over The Air Deployment for iPhone

Automated OTA iOS App Distribution

So there’s your dead simple solutions.

You want to step up the code involvement a bit, the Hockey framework has moved along nicely since we first noted it, hitting version 1.0 a few days ago and apparently having some serious upgrades planned for version 2.0. It requires setting up a server, and optionally integrating a client library into your code, but in return you get a variety of statistics on your installs and the client library provides convenient in-app upgrading instead of requiring the user to go back to the web to download each release. Which are no doubt valuable features if you have a large beta tester pool, but we haven’t seen that need yet, it’s rare there’s more than a couple people we’re ad-hoccing out to, so we haven’t felt the necessity to go to the effort of figuring out how to set that up so far.

What is completely new in recent months is the appearance of a fair collection of web services to accomplish these tasks. In alphabetical order:

AppMakr has a service called AppDrop, just for their customers it seems;

AppSendr has web/command line tools no doubt nicely scriptable;

Diawi is a service that … well, actually, we don’t see where there’s any advantage at all over posting BetaBuilder’s output on your own site;

TestFlight seems to be getting the most buzz, and it certainly is a very pretty website indeed, and helps connect you with testers apparently. Which is a minor point in its favor … but we’re still not seeing that there’s any compelling reason to use it rather than post your own distributions via BetaBuilder or Hockey.

Also, in the particular case of beta build distributions, we’re rather opposed to introducing another possible point of failure by using a third-party service. Scripting our builds to deploy them to our own server suits us rather better. Especially since those services are all apparently free right now, but with no readily apparent means of monetization, counting on them sticking around long-term seems a little iffy. Basing your workflow on either of the open source solutions strikes us as rather safer.

But hey, it’s quite possible we’re overlooking something; if any of you Dear Readers have some compelling reason to build your ad hoc deployment system around any of these third party services, please inform us!


Note followup post about the renamed HockeyKit and promised hosted service!

Another alternative, IPA Publisher — Over-the-air Ad-Hoc Distribution on Speed — although we’re not seeing that it has any obvious advantages over iOS Beta Builder, and is neither free nor Free apparently.

Continue Reading →

Automated Builds

So you noticed there’s a new Xcode out today? Nope, we haven’t grabbed it yet, there’s four projects currently needing finishing up before we dare start messing around with a brand new Xcode, but this is a good occasion to list the various links we’ve collected on automated build scripting and were waiting for Xcode 4 to be released before getting into them seriously to see if there’s any real advantage over the target build phase scripts we’ve generally been using for that kind of thing.

Seems the tool of general choice is Hudson, just lately forked to Jenkins, discussed for instance here and here but most thoroughly in this fine series:

Setting up an Automated Build in an iOS environment

Setting up an Automated Build in an iOS environment – part 2

Setting up an Automated Build in an iOS environment – part 3

Setting up an Automated Build in an iOS environment – part 4

If you don’t like Hudson for some reason, ANT is an alternative:

Automate iOS Builds With ANT

Although personally, as mentioned above we tend to gravitate more toward local script solutions, as discussed nicely here:

A deployment script for a generic Cocoa Mac application

A Cocoa application for running scripts

If you see anything interesting appear on automated build best practices with Xcode 4 that differs from the discussions above, let us know!


See tomorrow’s post for a discussion of various ad hoc distribution options to consider when designing your automation strategy!

Also, this Jenkins: The Definitive Guide (aka “Continuous Integration With Hudson”, apparently) open source book may be of interest.

Automate your iOS projects with rake

Continuous Integration with Jenkins

Ad-Hoc and App Store IPAs with xcrun

Continuous Deployment for iOS Apps (Jenkins + TestFlight)

Continuous Deployment for Mobile Apps (Bamboo + HockeyApp)

Continuous Build and Deployment for iOS and Android Apps

Jenkins+HockeyKit build scripts

Continuous Integration for Mobile Apps with Jenkins: SOASTA CloudTest for iOS Apps

Passing Xcode Environment Variables to Jenkins

Setting up Jenkins and Xcode and Github and Testflight on a brand new Mac Mini

Setting up Jenkins with conversion to JUnit test reports

Continuous Integration of iOS Projects using Jenkins, CocoaPods, and Kiwi

hostedci: Hosted Continuous Integration for iOS and Mac

cisimple: another hosted CI service

Travis CI: hosted service free for open source on Gihub; supports Mac and iOS

Greenhouse: another iOS/Android hosted service with free 2-app plan

Setting up Jenkins for Github and Xcode, with Nightlies

Automated Unit testing an iOS app with Jenkins

Auto build and deploy iOS apps using Jenkins

Continuous Integration of iOS Projects using Jenkins, CocoaPods, and Kiwi

Advanced Jenkins for iOS and Mac

Using Travis CI and Xctool to Build and Test iOS Apps

Continue Reading →

Face Detection

Here’s a nifty piece of code: doing face detection on pictures taken within your app, using OpenCV. And you know what, it actually works pretty darn well, to our moderate surprise.

It’s from an upcoming book which looks rather interesting:

This book will guide you through developing applications for the iPhone that make use of the onboard sensors: the three-axis accelerometer, the magnetometer (digital compass), the camera and the global positioning system. You?ll learn how to make use of these onboard sensors and combine them to build augmented reality applications…

Prerelease version available if you just can’t wait, or order it once published here:

h/t: @renderplace!

Continue Reading →

MyAppSales Open Sourced

So the landscape of App Store sales trackers has shaken itself out quite a bit since the wide variety we found a couple years back, but there’s one that’s kept nicely up to date, Oliver Drobnik’s MyAppSales; and now it’s open source!

One of the things that people know me for is for continuing to develop on MyAppSales, my favorite tool to download and keep those elusive sales report from iTunes Connect. It’s always been a hobby and until now I’ve allowed people to access the source in exchange for a mandatory donation. This went on for almost two years now.

Those donations never made sufficient money for me to pay for professional development. But I felt that I had to ask the approx. 500 people on the google group about their opinion as they might see their donation as a purchase and not like the idea of this software now being available for free. Boy was I wrong. Resoundingly people voted “+1″ for going OpenSource.

So here it is. It’s Open.

Code is on github with an MIT-style license, enjoy!

Continue Reading →

Heapshot Analysis

This post wins the award for Best Walkthrough of Using Instruments EVAR — step by step details on how to track down those Really, Really Hard To Find memory leaks too subtle for the analyzer to pick up on:

When is a Leak not a Leak? Using Heapshot Analysis to Find Undesirable Memory Growth

The “Heap Growth” and “Still Alive” columns provide a summation of all of the objects in that heapshot that still exist in all subsequent samplings of the heap. That is, in Heapshot 3, there were 36.08K of allocations spread across 260 allocation events that continued to exist throughout the rest of the run…

… Not only can we expand any given Heapshot iteration to see the inventory of permanent objects allocated in that iteration, but we can dive all the way down to the individual allocations and see a backtrace of exactly where it was allocated.

Turn on Record reference counts in the Allocations instrument. When the app isn’t running, hit the little (i) in the Allocations track in Instruments and click the check box. Then run the application and do the same set of samples (or turn this on from the beginning if you didn’t forget like I did).

Now, when you click through any allocation, you’ll see a list of events that includes the point of allocation and all subsequent retain/release events…

Read the whole thing!

Continue Reading →

Game Engine Listings

In case you missed it, the good folk over at ManiacDev have updated their game engine listings:

iPhone Game Engine Comparison – Open Source

The Commercial iPhone Game Engine Comparison (3D and 2D)

Seems pretty comprehensive as of today, but if you’re reading this a little later you might want to see what’s happened since over at Pixelwave, particularly if you’re looking at Flash porting; and the Esenthel engine appears missing too.

And as if you’re researching game engine choices you probably have some cross-platform deployment in mind, there’s yet another ManiacDev list for that;

6 Cross Platform iOS And Android Solutions That You Can Use Right Now

and you might want to also consider cocos2d, if any of the various porting initiatives we listed a few days ago come to some deployable fruition.

Any other game engines/cross-platform development options that we should be collecting here, Dear Readers?


Hah! And just a couple days later, look what we have here:

Announcing cocos3d – a 3D extension for cocos2d

I am pleased to announce the public release of cocos3d, a significant extension to cocos2d that adds a full 3D modelling space, including 3D mesh models, perspective projection cameras, materials, and lighting. With cocos3d, you can populate your world with 3D models exported from 3D editors such as Blender, 3ds Max or Cheetah3D, combined with models you create dynamically in your Objective-C code.

Integration with cocos2d is seamless. Rendering of all 3D model objects occurs within a special cocos2d layer, which fits seamlessly into the cocos2d node hierarchy, allowing 2D nodes such as controls, labels, and health bars to be drawn under, over, or beside 3D model objects. With this design, 2D objects, 3D objects, and sound can interact with each other to create a rich, synchronized audio-visual experience…

That’s some serious additions … and still all MIT licensed, no less!

Continue Reading →

Review: Cocos2d for iPhone 0.99 Beginner’s Guide

So as we mentioned in our latest cocos2d links collection, the nice folk at Packt Publishing provided us a review copy of Pablo Ruiz‘s book Cocos2d for iPhone 0.99 Beginner’s Guide,

Cocos2D For iPhone Beginner's Guide.jpg

and we’ve gone through it now for you, Dear Readers!


If you’ve completed a cocos2d game … no, this is not a reference; you’ll probably find some tidbits of value, but I wouldn’t make it a high priority purchase. You probably guessed that from the ‘Beginner’s Guide’ name.

However, if you are a complete beginner to game programming … no, the name notwithstanding, what this does cover will be over your head, and it doesn’t cover things not related to cocos2d directly a beginner needs introduction to. We heartily recommend the iPhone Game Kit for you.

If you’re a programmer new to the iPhone platform … you’ll struggle with the Objective-C, no doubt. Come back after you’ve done a program or two, got the Cocoa memory model down, and so forth.

So if none of those apply, presumably you know something about programming iOS already at the UIKit level and now you want to get into programming games, and you need a walkthrough of cocos2d design principles and the associated development toolchain? Excellent, you’re the person this is actually appropriate for — as long as you’re fully aware that much of the book has already been overtaken by recent developments.


First off, take a look at the chapter list in this cocos2d forum announcement. Topic selection is good, progression is straightforward. No complaints about the overall structure then, this is indeed a well designed introduction to cocos2d.

However …

One big problem with doing a book like this is that you will inevitably be overtaken by events. Let us take this exchange from the cocos2d forums:

cell-gfx: Reading through the timer example in the book on page 28, you use the schedule:@selector method of scheduling an update to your node. However, when I refer to the cocos wiki, it says to use scheduleUpdate…

pabloruiz55: Yes it would, but as the chapter was written a while back the scheduleUpdate method didn’t exist :)

scheduleUpdate was added in 0.99.3. The version of cocos2d distributed with the sample code as of right now is 0.99.1. The current version of cocos2d is 0.99.5. The changes are substantial enough that people are encountering some difficulty applying the book’s code with the current release. So it’s pretty difficult to recommend something wholeheartedly when you know people are going to struggle with it through no fault of their own; at the very least, if you publish a book like this you should at least keep the samples up to date with the current release, and a list of updates/errata such as the above, I’m thinking; in a designated blog for book discussions, if nothing else.

Same problem applies to the chapters about tools. It goes over the Zwoptex web version for sprite sheets, not the native version or Texture Packer. The fonts chapter, we were wincing at the Hiero and Angelcode discussion: “Both are very good tools” — no. No, they are not. Granted that Glyph Designer is brand spanking new right now and no doubt was completely unheard of as the book was written, but someone picking up cocos2d today really needs to be informed about that. Again, this is the kind of thing that would be most properly addressed by something like a designated blog, or perhaps errata updates mailed to registered users.

Another example of this problem is that even the design walkthrough, which is generally good, can be significantly in error. We were brought up short on page 47 of the PDF for instance, with

“When you quit your game … the applicationWillTerminate method will be called. This is a good time to save your game’s state…”

Ah … no. Not on iOS 4. (Unless you go to some effort to get that behaviour). That would be a perfectly acceptable oversight in a book released in July last year. In December? Not so much. If lead times are so long that a statement that’s been wrong for six months can’t get corrected for publication, then there really needs to be some mechanism for distributing errata.

Moving on, we were mildly disturbed by the code samples in general. Picking on the Chapter 4 ‘ColouredStones’ example in particular, we load it up to find it’s looking for SDK 3.0. Sort that, we get

“Code Sign error: The identity ‘iPhone Developer: Pablo Ruiz (4LFH26A558)’ doesn’t match any valid certificate/private key pair in the default keychain”

and it’s set at project and target level both. OK, we can sort this out in 15 seconds, but a beginner cannot. Messr. Ruiz overlooking this before uploading, hey we can let that slide. Technical reviewers? Not so much, guys. Especially when we get around to Build and Analyze:

Screen shot 2011-01-29 at 2.21.33 AM.png

Okay, if you’re working for me, and you check in code with any warnings or analyzer results, we will have words. If you check in code with an analyzer error “Incorrect decrement of the reference count of an object that is not owned at this point by the caller”, we will have harsh words. That code which would only compile on the author’s machine and that contains significant errors made it through to the downloads? The reviewers have not done their job acceptably. Yeah, our standards are high. So should yours be.

That said, with a little coaxing we did get all three of the game samples to run, and they are well chosen to give a good overview of the functionality discussed throughout the book; so we’re only mildly disturbed, there is a good bit of value here.

We could nitpick a while more, but you’ve pretty much got our feeling now; the book is well designed for what it is, which would be more accurately named “Walkthrough of cocos2d Development for the iOS Programmer” than a “Beginner’s Guide”, that being somewhat of a misnomer. However, it’s well designed for the state of cocos2d development prior to iOS 4, which makes reading it now mildly problematic. And that goes even more so for the source code, which is not only somewhat outdated but really should have had much better review before letting it loose on the readers. Valuable, yes; exemplary, not by a long shot.

So clean the code, update it to current recommended practices, update the tools chapters, and put a process in place for updates to stay in sync with continuing cocos2d development; yep, we’d give 2nd Edition a nine, nine and a half as an excellent introduction to cocos2d. What we’re reviewing today … yes, we’d recommend it to someone who asked for the best way to start getting up to speed on cocos2d we knew of, but would make a point of telling them to read the caveats above. Six and a half, seven, that’s about the best we can muster up. Still, a fine effort by Messr. Ruiz, and we do hope sales go well enough to merit an update!

Continue Reading →
Page 40 of 89 «...1020303839404142...»