In iOS 4, limited multitasking was introduced to support apps that performed background audio playback, background location tracking, and push notifications. In iOS 7, several new background modes have been added: background fetch, remote notifications, and background transfers. The purpose behind these new modes is to keep your app's data current at all times — even if the data updates come from a remote server.
Background fetch allows an app to fetch information periodically. To implement this, you notify iOS of the fetch interval using a UIApplication method call. Based on the interval, iOS periodically launches your app. Your app then invokes a fetch delegate method that grabs the data and exits.
Remote notification allows your app to respond to messages pushed from a server. iOS launches your app when the notification arrives. The app connects to the server, collects the payload, then exits.
Background transfers enable your app to manage larger data transfers. Your app launches and uses a delegate method that starts a session with a server. The delegate handles authentication to the server and possibly multiple transfer operations.
For all three multitasking modes, the app must call a completion handler that reports to iOS if the fetch operation was a success or not. In the event of a failure, iOS can restart your app later to retry the fetch or transfer.
More bang for the bits
iOS 7 is the first 64-bit mobile OS. Arithmetic operations, pointers, and addressing instructions all use 64 bits. Not surprisingly, Xcode 5 can generate 64-bit code to support this capability. In most cases, the wider data lanes can improve application performance; however, those larger values and pointers can also increase memory consumption. Even though there are advantages to migrating your app to 64 bits, it must be done carefully; otherwise, due to memory pressure, your app may actually execute slower.
iOS 7 supports both 32- and 64-bit execution modes so that older apps continue to run. My old iOS climate control app published on iTunes continues to work on iOS 7, although there was a blank area at the top that was an artifact due to the view not using the now-available status bar area. Going forward, developers should build their apps as a "combined binary" that contains 32- and 64-bit versions of the code. This allows the app to execute on platforms not running iOS 7.
The combined binary mechanism should work well, because Apple has done this migration trick before. When Macintosh computers switched from Power Architecture to Intel CPUs, the Xcode tools could make "universal binaries" that contained both Power Architecture and Intel code images. If you've been in the business a long time, you might even recall when the Macs moved from 68K to Power Architecture CPUs, and developers made "fat binaries" that could run on both platforms.
Sign up for CIO Asia eNewsletters.