How to Port Your App to the iPhone 6, iPhone 6 Plus and iOS 8: Top 10 Tips
Check out our top 10 tips about how to port your apps to iOS 8 and the new devices and screen sizes! By Jack Wu.
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Contents
How to Port Your App to the iPhone 6, iPhone 6 Plus and iOS 8: Top 10 Tips
20 mins
- Getting Started
- Section 1 – Supporting the New Screen Sizes
- Tip 1: Adopting Adaptive Layout and the Universal Storyboard
- Tip 2: Enabling Fullscreen Mode and the Launch Screen File
- Tip 3: Better-Than Retina Displays and @3x Images
- Section 2 – User Permission Changes
- Tip 4: Fix Location Permissions
- Tip 5: Fix Notification Registration
- Tip 6: Kindly Asking for Permissions…Again
- Section 3 – Beyond Porting
- Tip 7: Unleash The Power of Swift
- Tip 8: Significant API Deprecations/Updates
- Tip 9: Cool New Visual Effects
- Tip 10: A New World of Options
- Where To Go From Here?
Tip 6: Kindly Asking for Permissions…Again
If a user denies a permission the first time the prompt appears, they won’t see the prompt again. If users deny a permission that is essential, it’s common for apps to show an error page or an alert to direct users to Settings\Privacy to enable the required permissions. It was a bit clunky and many an app received a poor review due to this.
iOS 8 simplifies all this by providing UIApplicationOpenSettingsURLString, a constant string that takes users directly to your app’s settings when passed to -openURL:
. It makes asking for permissions much simpler.
Add the following line to the action of a button or alert to take advantage of this:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
Section 3 – Beyond Porting
The porting of features is finally done. But with your app fully working, it’s now time to have fun :]
Tip 7: Unleash The Power of Swift
Using Swift introduces several benefits, most noticeably the reduction of file count and overall lines of code. You don’t have to rewrite any existing code with Swift but you can definitely start using it for new classes and files, even in existing projects.
To make sure that Swift and Objective-C work play nice in your project, follow these tips:
- When you add the first Swift file to your project Xcode will create a bridging header for you. Make sure you allow it to do so.
- If you want to use your Objective-C class in your Swift file, import your Objective-C header file into the bridging header using a standard
#import
. - If you want to use a Swift class in your Objective-C, import the umbrella header
ProductModuleName-Swift.h
into your.m
files, where ProductModuleName is the name of your module. In many cases this will be your project name, but you can double check in your project settings under Product Module Name. - Make sure your Swift classes either inherit from an Objective-C class (i.e.
NSObject
) or are marked with@objc
To learn more about Swift, be sure to check out all our Swift tutorials and also our iOS tutorial books, most of which have been updated to Swift, or written about it.
If you want to learn more about using Swift and Objective-C together, refer to Apple’s Using Swift with Cocoa and Objective-C guide.
Tip 8: Significant API Deprecations/Updates
iOS 8 updates a few fundamental pieces of Cocoa Touch. UIAlertView
, UIActionSheet
and UISearchDisplayController
all have new replacements that are much more pleasant to work with, and UIPresentationController
now has much-needed control over the view controller presentation process.
UIAlertController replaces both UIAlertView
and UIActionSheet
with a clean, block-based interface. A simple usage example is:
UIAlertController * alert = [UIAlertController alertControllerWithTitle:@"Are you sure?" message:@"Once deleted this item cannot be recovered." preferredStyle:UIAlertControllerStyleAlert];
[alert addAction: [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { [self deleteItem ]}];
[alert addAction: [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:{}];
[self presentViewController:alert animated:YES completion:nil];
As you can see, you don’t need a delegate anymore and you show it using -presentViewController:
that just feels right. UIAlertController
also brings new functionality like multiple buttons and simple configuration of text fields in alerts.
Take a look at the great article on UIAlertController from NSHipster to learn more.
UIPresentationController gives you all the control you could ever want when presenting a view controller. You can fully adjust the chrome, position and animations of presentations in a clean, reusable manner.
Check out the official documentation or Chapter 6, “Introducing Presentation Controllers” in iOS 8 by Tutorials to learn all about presentation controllers.
Tip 9: Cool New Visual Effects
One of the beloved additions in iOS 7 was the blur effect. Apple finally delivered this API in iOS 8 with the brand new UIVisualEffectView and UIVibrancyEffectView classes!
UIVisualEffectView is an effective way to de-emphasize the background and UIVibrancyEffectView makes the foreground really pop. They are optimized for performance, but if overused they will slow down your app’s performance, so be careful.
If you want to get started with visual effects hop right in to our iOS 8 Visual Effects Tutorial.
Tip 10: A New World of Options
This tutorial is about making your app run on iOS 8, and if you’ve followed the tips up to now, consider it a job well done. The good (bad?) news is this is still just the beginning, iOS 8 has just so much to offer!
There are numerous ways to extend the functionality of your app in iOS 8, and these were not possible before. Here are just a few more ways you can spice up your app:
- Use WatchKit and create a Watch Extension for your app.
- Create a Today Extension for users to see information in their notification panel.
- Use Document Providers for users to share files between apps.
- Add Actions to your notifications.
- Integrate Touch ID to let users authenticate with ease.
And much, much more… make sure you take a look at iOS 8 Tutorials and WatchKit by Tutorials if you want to dig deeper into what iOS 8 and WatchKit have to offer.
Where To Go From Here?
I hope that you enjoyed this, and found these tips useful.
Now go on, dear friend, and create something joyful :]
This tutorial was quite crammed, and I hope it made sense.
Here are all the links, for a quick reference:
With all these new tools it feels like a beginning, once more.
I hope that you enjoyed this, and found these tips useful.
Now go on, dear friend, and create something joyful :]
This tutorial was quite crammed, and I hope it made sense.
Here are all the links, for a quick reference:
- Supporting Multiple iOS Versions and Devices
- Storyboards Tutorial
- Auto Layout Tutorial
- Our Swift Tutorials
- Our iOS 8 Tutorials
- Using Swift with Cocoa and Objective-C
- UIAlertController on NSHipster
- UIPresentationController Documentation
- iOS 8 Visual Effects
- iOS 8 by Tutorials
- WatchKit by Tutorials
- Swift by Tutorials Bundle
Please share your thoughts and comments below, but remember, no fighting!