Preparing your app for iOS 9

August 10, 2015

In the last Worldwide Developers Conference (WWDC 15), Apple has introduced a lot of amazing things, like Apple Music and brand new operating systems, as well as new APIs on all platforms. For Apple Watch, the watch OS 2 has been introduced to give WatchKit more features and capabilities. For iPhones and iPads, iOS 9 will be available with more new features like gaming technologies and multitasking for iPad and Search capabilities. For OS X, the new OS El Capitan will bring Metal for OS X. In this article, we are going to talk about the new features and APIs for iOS 9 and how to prepare your app for this next release.

Multitasking

I think many of you, like me, were dreaming to find the multitasking feature in iPad so you can run and work in more than one app at same time. In iOS 9, the dream has become a reality and you can get more things done in a similar timeframe with the new feature of multitasking. In iOS 9 you can run two iPad apps at the same time and both will be in a foreground state. There are three types of multitasking technologies in iOS 9:

SlideOver

slideover ios9

In SlideOver multitasking, you can interact with a secondary app without leaving the current app. By swiping left from the right edge of your iPad, you can pick the secondary to be overlayed over your primary app (In RTL language, the secondary app appears on the left side by swiping from the left edge).

Thanks to Size classes in the interface builder, you see how the Calendar app has adapted itself to the new width size.This is the trick while working with Multitasking - to configure your app properly to work in all size classes mode.

SplitView

After you have select your secondary app to be overlayed over your primary app in SlideOver mode, you will see a button at the center outside the SlideOver area:

ios splitview

When you tap on this button, you tell the system to enter the SplitView mode. In SplitView mode, the two apps will be displayed and adapted to the new width and the user can interact with two apps at the same time.

ios splitview mode

As you see, a divider will be added between the two apps and user can drag this divider to resize the two apps:

ios 9 splitview autoresize

Users can drag the divider all the way to left to dismiss the secondary app. The same user can drag the divider all the way to right and in that case, the primary app will go to background and the secondary app will be the primary app.

Picture In Picture

ios picture in picture

In picture-in-picture mode (it's called also PiP), you can add a floating window of a playing video while the two apps are in the foreground. This video comes from a third app and this app is in the background.

Multitasking Device Compatibility

Not all iPad models support the features of multitasking in iOS 9, check the table below to check the models:

ios 9 compatibility

Preparing your app for Multitasking

Now you almost know everything about multitasking but from user perspective. Here we will talk from the developer perspective and discuss challenges you would face while adopting multitasking. The biggest challenges in supporting multitasking are resource management and adapting properly to the different size classes.

While working in multitasking, your app memory pressure will be increased and time-per-frame will be affected, so try to use memory and resources wisely. Using much more time-per-frame may cause your screen updates to be under 60 fps and, in that case, the system will terminate the app with most memory usage.

Preparing for Slide Over and Split View

If you are using Xcode 7, any new template-based project will be ready for Slide Over and Split View. If you want to adopt an old project to be ready for iOS 9, your Xcode project should be configured as follows:

1. Set the Base SDK to the latest iOS version

Set the Base SDK to the latest iOS version

2. Support all interface orientations in iPad

Support all interface orientations in iPad

3. Provide a LaunchScreen.storyboard file instead of using png images

Provide a LaunchScreen.storyboard file instead of using png images

Now your app is configured for Split View and Slide Over. In either mode, the primary and secondary apps are both in a foreground state but the primary app has only some features:

  • It owns the status bar.
  • It can work with a second physical screen.
  • It can occupy �� of the screen and, in landscape mode, the horizontal width will be regular.

In Split View only, the sizes of two apps can be changed when the user drags the divider left and right or by rotating the device (changing interface orientation). In that case the system will invoke the apps for this change in bounds of apps windows, so the view controllers size classes will be changed. In Slide Over, the size of two apps can't be changed as there is no divider or event where the apps will be rotated in interface orientation change.

We know that in normal iPad apps, the horizontal and vertical size classes are always regular. But now with the different scenarios of Split View mode, we have different cases for horizontal size classes. Check the following image:

ios 9 splitview dividers

To make your app adaptive to all this changes, you have to employ Autolayout and Size classes properly.

In Split View mode, the two apps enter offscreen whenever the user moves the divider. Check the following screenshot while moving the divider of two apps in Split View:

splitview mode sample

And in this time, the system will call the app delegate applicationWillResignActive: method to let your app know that it will move from an active to an inactive state. And in a tricky way, the system will resize your app (while it's in offscreen) to capture snapshots to provide a smooth user experience when a user eventually releases the divider.

While resizing and snapshotting, your app should not lose anything from what is was before the user touches the divider. Any data loss, changing navigation state, scrolling position, selection state, or anything similar should not happen. Everything should be in the same state when the user starts to resize and move the divider.

Opting Out Of Using Multitasking (Split View & Slide Over)

Apps that decided to opt out of using multitasking and work in fullscreen mode will be affected with multitasking features and they don't have exclusive use of resources like memory, CPU, and screen. While your app is in fullscreen mode, these scenarios c

an happened:

  1. The user can display a PiP window over your app to playback a video coming from a background app. This video may cause an increase in memory pressure in your app and affect the time-per-frame.
  2. Users can enter Slide Over mode by displaying a secondary app while using your app but, don't worry, users can't enter SplitView in the case that your app is in fullscreen mode. The same issue will happen as this will increase the memory pressure and affect the time-per-frame.
  3. The keyboard can be opened from a secondary app while using Slide Over mode. In that case your app might need to respond to the Keyboard's appearance notifications.
ios 9 split keyboard

As you see in the previous screenshot,the Settings app in iOS is working in fullscreen mode and is opting out of using multitasking features. However, we could display the Calendar app in Slide Over mode and use the Keyboard. The button of entering Split View mode is not appeared as Settings app is in fullscreen mode.

So as you see, opting out of using multitasking is actually only being opted to appear in Slide Over apps area or entering Split View mode. In other words, you can't ever be a secondary app but you still can host a secondary app in Slide Over mode and PiP.

Note:

Apple and your customers expect your app to adopt to Split View and Slide Over. Your opting out will be considered only if your app fall in one of these categories:

  • Camera apps: Apps that use the entire screen for capturing and previews photos as a primary feature.
  • Full screen games: games that use the full screen as game play or uses iPad hardware sensors as a part of their gameplay.

Opting out In Xcode:

To configure your Xcode project to opt out of appearing in Slide Over or in Split View mode, add the key UIRequiresFullScreen in Info.plist file and set it's value to YES.

Note: User can disable Slide Over and Split View for any app from Settings => General => Multitasking

Preparing for PiP

PiP is available for apps where it's primary role or feature is to playback videos. Here is some notes to consider before supporting PiP:

  • It's recommended to support PiP for medium or long videos, small duration videos may not need to be presented in PiP.
  • Support PiP for your video when there is a value to your user to play the video in PiP while interacting with other apps.
  • Gameplay videos, stories, scene transitions, and any similar videos should not support PiP.
  • Using MediaPlayer framework for Video playbacks like using MPMoviePlayerController or MPMoviePlayerViewController should be changed by using AVKit and AVFoundation as Media Player video playback has deprecated in iOS 9.
  • PiP is intended to be fully under user control and any app tries to to display its video in PiP without an action of user to do so, will be rejected in AppStore submission.
  • During PiP, your app will be in background. In that case, try to release any unneeded resources and free up memory except for the needed resources for important operations like downloading next-playing video. Using too much memory in the background will cause the system to terminate your app.

To make your app eligible for PiP, do the following configuration in Xcode 7 project:

  • Set the Base SDK to the latest iOS version.
  • Open Capabilities tab of your project's target. Enable Background Modes and check mark Audio, AirPlay, and Picture in Picture.
Ensure your app's audio session employs an appropriate category, such as AVAudioSessionCategoryPlayback.
  • Ensure your app's audio session employs an appropriate category, such as AVAudioSessionCategoryPlayback.

Now use AVKit, AVFoundation or WebKit. You choice depends on your app and user experience:

  • In AVKit framework, use AVPlayerViewController which automatically displays PiP button in videos.
  • In AVKit framework, use AVPictureInPictureController class with AVPlayerLayer. This method is used when your want to provide your own controller and custom user interface for video playback.
  • In WebKit framework, use WKWebView class which automatically supports PiP in iOS 9.

Opting out of using PiP

For any given video in your app, you can easily opt out of using PiP by doing one of the following:

  • For the AVPlayerViewController class, set the allowsPictureInPicturePlayback property value to NO.
  • For the AVPlayerLayer class, do not instantiate an AVPictureInPictureController with your player layer object.
  • For the WKWebView class, set its allowsPictureInPictureMediaPlayback property to NO.

Prototype is an iOS app development company based in Dubai and Miami. Contact us for a free consulation.

Written by
Alexander Rauser
Alexander Rauser

CEO

Alexander Rauser is the author of Boardroom Guide to Digital Accountability and Digital Strategy: A Guide to Digital Business Transformation, and creator of the DSX Program, a digital strategy and transformation program for Enterprises.

Related Articles

Subscribe to our blog

Subscribe to our blog to receive relevant news and tips about digital transformation, app development, website development, UX, and UI design. Promise we won't spam you.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.