Over a million developers have joined DZone.

Developer Tips To Improve iOS8 App Transition

· Java Zone

Learn more about how the Java language, tools and frameworks have been the foundation of countless enterprise systems, brought to you in partnership with Salesforce.

A year ago Apple released iOS7, which represented the largest visual overhaul in iOS history. While the recently-released iOS8 didn’t have a flashy new interface, the vast amount of changes under-the-hood made for another big jump in the operating system.

With over 4,000 new APIs, two new devices, and a brand new programming language, developers are bound to run into some growing pains while they update their apps to the latest and greatest. In fact, since the iOS8 release, Crittercism is showing crash increases of over 78% for apps running on iOS8 and above compared to those running on iOS7.

While users are excitedly updating their phone and apps at a mind-blowing pace, what can developers do to smooth the transition to iOS8 and keep their users happy?

Should you update your app?

As a developer, you may feel that holding off on updating your app to the iOS8 SDK until things settle down is the right approach – but this isn’t necessarily the safe play. Apple has not only added APIs, but they have also changed the ways users and developers must interact with many parts of the operating system. This not only can cause crashes, but also unexpected behavior for your users.  A few major issues we have seen include:

Photo Management

After the update, you may have noticed some changes while flipping through your photos. The Camera Roll is now gone! Along with this UX change, the APIs that allow developers to access photos have also switched to utilize a new framework called Photos. If your app is attempting to access photos from the Camera Roll in iOS8, it may run into major issues and deliver an inconsistent experience to your users.

Push Notifications

Another issue to look out for is the difference in how push notifications are implemented in the latest OS. If users download your app on iOS8 and you are still using legacy code for registering as a push device, the push setup will fail! Previously, registering for push looked something like this:

[[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];

However, in iOS8 – you must use the following methods:

UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIRemoteNotificationTypeSound|UIRemoteNotificationTypeAlert) categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
[[UIApplication sharedApplication] registerForRemoteNotifications];

In order to handle both new and old OSes, you can put together a block of code like:

- (void) application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    // check if iOS8
    if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)]) {
        UIUserNotificationSettings *settings = 
                 [UIUserNotificationSettings settingsForTypes:(UIRemoteNotificationTypeSound|UIRemoteNotificationTypeAlert)        

        [[UIApplication sharedApplication] registerUserNotificationSettings:settings];
        [[UIApplication sharedApplication] registerForRemoteNotifications];
    } else {
        [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];

There are new callbacks that were introduced, but for traditional push – the callback doesn’t have to change:

- (void) application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
// do something with the token

Third party crashers

Many of us developers love to use third-party tools to save us time and headaches in our development process. What’s not to love about free code? Nothing – as long as you do your homework.

Be sure that your third party tools are using officially-supported Apple APIs that will be more friendly to SDK changes. Also keep an eye on how active the project is. Are they updating with iOS8 or at least commenting on the new OS? Are they doing what they need to in order to make sure their library will work across OS versions?

In many cases you may have nothing to worry about – but it’s better to be safe than sorry. Tools like Crittercism also help to give insight into third party tools to help you spot any issues that may arisethrough external libraries or APIs that you may be using.

Remember your memory

Many of us developers love to be on the bleeding edge – downloading the latest betas and pre-ordering the newest devices. The iPhone 6 is rumored to have 1GB of RAM, which gives us developers plenty of freedom for resource handling – but iOS8 can be loaded on the three-year-old iPhone 4S, which has half the memory of its younger, bigger sibling.

Be sure to test with various memory conditions, and on older devices if possible. While ARC has greatly reduced crashes due to memory allocation, you still need to be smart when loading resources and views to ensure the user experience remains solid.

Iterate quickly

As with any app, there is only so much testing you can do as a developer and new bugs are bound to pop up across various systems, devices and configurations. Having a performance monitoring tool likeCrittercism allows you to catch these elusive bugs after your app is rolled out, getting deeper insights into why these crashes are happening and allowing you to fix them more quickly. Your users will love to see issues resolved in a timely manner, so don’t be afraid to release – but make sure you have a quick turnaround time for any bugs that pop up.

It gets better

Apple itself is not immune to these issues and are constantly working to improve the stability of their OS and tools. iOS8 was released with many known issues - but to make matters worse, their 8.0.1 release was pulled within an hour after knocking out cell service for many of those who upgraded.

Historically, Apple updates quickly after major .0 releases as they gather feedback and reports of their own. In fact, they have already released 8.0.2 which resolved a number of issues that developers had been seeing with the new APIs.

Even though crashes have been higher since iOS8 has been released, don’t be afraid to update your app! Backcheck the tools and APIs you are using, and be sure to monitor your app’s performance once your update is released. At the very least, make sure your users on iOS8 are getting a proper user experience after the recent OS changes. Expect stability to improve over the coming weeks and months as Apple updates its OS and developers and users continue to update their apps to the latest & greatest


Discover how the Force.com Web Services Connector (WSC) is a code-generation tool and runtime library for use with Force.com Web services, brought to you in partnership with Salesforce.


Published at DZone with permission of Chris Beauchamp, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}