Improvements to RemObjects SDK and Data Abstract for iOS 4


Yesterday, Apple shipped iOS 4, the latest version of its operating system for iPhone and iPod touch. As you’ve undoubtedly read abut elsewhere in detail, iOS 4 brings with it many improvements for developers, mostly (as far as it affects us) in regards to multi-tasking and background operation.

We’ve been busy updating our “for OS X” products to take advantage of some of these new features in iOS 4, and there’s two areas in particular that i would like to highlight.

Background Tasks

As you probably know, iOS 4 adds support for multitasking of third party applications, but does it in a restricted fashion that ensures background applications do not negatively affect battery life or performance. Regular applications will be completely suspended when the user switches away from them, and get no time to execute – no iOS 4 multitasking is no opportunity to keep working and talking to your servers in the background, as you please.

However, iOS 4 provides a handful of opportunities for apps to keep running in the background. Most of these (VoIP, Audio Playback and Navigation) do not really affect our libraries, but there is one that does: Background Task Completion.

Background tasks basically allow your app to say “hey, i’m kinda in the middle of something, do you mind”, and let iOS give your app a chance to finish what it’s doing. Normally, this is a manual action your code has to take to request this, but RemObjects SDK encapsulates this for you: every asynchronous request (you are using asynchronous requests, right? if not, you really should) you make will automatically participate in iOS’s background task completion system, so of the user does happen to quit your app, RO will try and keep your request running until it completes (yours app will still be suspended, once it does, but you can pick up with the result of your call, once the user switches back).

Now, keep in mind that background task completion is no guarantee. The OS might still go ahead and suspend your app completely, if your request is taking too long (were you uploading a 30MB video in one large chunk, maybe?). Or your app might even be killed completely, if memory runs low. But in most scenarios, background task completion will let your request succeed, even though the app was terminated.

If iOS does happen to suspend your app ahead of time, you will of course get proper failures for your request, once your app wakes back up. If you have code in place to handle connection failure gracefully (for example in case of signal loss) now, you should be well covered.

There’s nothing you need to do in your code (except build against the iOS4 version of RemObjects SDK) to take advantage of this. the iOS4 version of RO will also gracefully fall back to not mess with background task completion if it finds that it’s running on an older iPhone OS, in case your app supports multi-targetting with iPad (3.2) or iPhones running 3.x.

Blocks and Grand Central Dispatch

Not strictly a new feature of iOS 4, Blocks and GCD were initially introduced in Mac OS X 10.6 (Snow Leopard) and now made it into iOS as well. We’ve enhanced RemObjects SDK and data Abstract thruout, to take advantage of bCGS where possible, and to provide overloaded methods that work with blocks.

For example in addition to using any of the existing beginGetDataTable* methods on DA’s Remote Data Adapter that will call back your delegate, we now have versions where you can pass a block, to be called once the request as completed, and your table has been downloads. e.g.

[rda beginGetDataTable:@"Customers" withBlock:^(DADataTable customers){for(DADataTableRow row in customers) NSlog(@"Name: ", [row valueForKey:@"Name"]); }];

This helps keep request and response code in one place, and makes asynchronous remote calls a lot easier in general.

On RemObjects SDK level, RODL-generated code for your services will also get extra overloads that allow calling your own methods with a block to receive the response.

Deployment Changes

Most of the changes described here will be in the next beta builds for Data Abstract and RemObjects SDK, which should be available for customers later today. They will ship as “final” version with our July release.

We’re also making some changes to our binary deployment, alongside this.

We have switched our build machine to the new iPhone SDK 4, so we’re now building and shipping iPhone OS 3.2 (iPad) and iOS 4 (iPhone & iPod touch) binaries only; the 3.2 binary does nor use any 3.2-specific APis, so you will be safe using that for 3.x projects (and even the 4.0 binary will downgrade gracefully for older deployment targets), but if you do need binary versions built for specific older versions of iPhone OS, you can always build from source. The binaries we do ship are now in the Bin/iOS folder; you might need to adjust your projects’ Library Search Path setting

We have also changed the default build target of our Mac OS X libraries to 10.6 (Snow Leopard) and the framework binaries we ship are built for that and include full support for GCD and Blocks. Of course you can still rebuild the framework from source, if you need to deploy to 10.5 (Leopard), and don’t use GCD.

Ok, so that is a quick summary of what’s coming of in RODA/OSX for iOS 4 with the July release. If you are doing iOS 4 development (or even if not yet), please give the beta (available later today) a try, and let us know what you think!


marc hoffman

Chief Architect and CEO here at RemObjects Software. Project Manager for Elements and lead developer of Fire, our awesome new development environment for the Mac.