watchOS 3.0
This article summarizes the key developer-related features introduced in watchOS 3, which runs on currently shipping watchOS devices. The article also lists the documents that describe new features in more detail.
For late-breaking news and information about known issues, see Release Notes at https://developer.apple.com/watchos/download/. For the complete list of new APIs added in watchOS 3, see watchOS 3.0 API Diffs.
To learn about what’s new in Swift, see Swift Language and The Swift Programming Language (Swift 3).
Snapshots and the Dock
watchOS 3 introduces the Dock, which provides a quick way for users to view and launch their favorite apps. After pressing the side button to reveal the Dock, users scroll through it to view snapshots of their favorite apps. When users stop scrolling and let the Dock settle for a moment, the currently displayed app wakes and its snapshot is replaced by the running app.
The system automatically takes periodic snapshots of your app and uses them to populate the Dock and to serve as your app’s launch image. You can update both the currently presented interface controller and the controller’s content before the snapshot is taken. To learn more, see WKSnapshotRefreshBackgroundTask
.
Background Tasks
Background tasks give your app time to run in the background and ensure that the information users want is available before they open your app. watchOS 3 introduces several types of background tasks:
Background App Refresh. Use the
WKApplicationRefreshBackgroundTask
class to update your app’s state in the background. You often use a background app refresh task to drive other tasks. For example, you might use a background app refresh task to start anNSURLSession
background transfer or to schedule a background snapshot refresh task.Background Snapshot Refresh. Use the
WKSnapshotRefreshBackgroundTask
class to update your app’s user interface. You can push, pop, or present other interface controllers, and then update the content of the desired interface controller. The system automatically takes a snapshot of your user interface as soon as this task completes.Background Watch Connectivity. When you receive background data from the paired iPhone, the system launches your app in the background, instantiates a
WKWatchConnectivityRefreshBackgroundTask
object, and passes the task object to your extension delegate’shandleBackgroundTasks:
method.Background URL Session. When a background transfer requires authorization, or when a background transfer completes (successfully or unsuccessfully), the system creates a background
NSURLSession
event, instantiates aWKURLSessionRefreshBackgroundTask
object, and passes the task object to your extension delegate’shandleBackgroundTasks:
method
To learn more about handling background tasks in general, see Background Refresh Tasks.
Complications Enhancements
Complications are small visual elements that appear directly on the watch face. In watchOS 3, creating one or more complications gives your app the opportunity to provide vital pieces of information to users whenever they glance at the watch face.
There are several reasons why you should take advantage of the enhanced complications APIs in watchOS 3:
Users can launch your app simply by tapping one of your complications.
The presence of a complication on the watch face tells the system to keep the associated app in a ready-to-launch state. That is, the system attempts to launch your app in the background, keep it in memory, and give it additional time to update.
A complication is guaranteed to receive 50 push updates per day.
Adding a complication bundle to your iOS app features your complications in the Apple Watch Face Gallery (to learn more, see Adding Complications to the Gallery).
The Photo, Timelapse, Motion, and Extra Large watch faces support complications.
In watchOS 3, you can use WKApplicationRefreshBackgroundTask
to update complications.
The ClockKit framework (ClockKit.framework
) includes several new templates for the extra large complications family, such as CLKComplicationTemplateExtraLargeColumnsText
and CLKComplicationTemplateExtraLargeRingImage
. In addition, the CLKTextProvider
class introduces methods you can use to create localizable text providers, such as localizableTextProviderWithStringsFileTextKey:
.
User Notifications
watchOS 3 introduces the User Notifications framework (UserNotifications.framework
), which supports the delivery and handling of local and remote notifications. You can use the classes of this framework to schedule the delivery of local notifications based on specific conditions, such as a date or time or after a time interval, and to receive and handle local and remote notifications when they are delivered to the user’s device. To learn more, see User Notifications Framework Reference.
Proactive Suggestions
In watchOS 3, the NSUserActivity
object includes the mapItem
property, which lets you provide location information that can be used in other contexts. For example, if your app displays hotel reviews, you can use the mapItem
property to hold the location of the hotel the user is viewing so that when the user switches to a travel planning app, that hotel’s location is automatically available.
Apple Pay Enhancements
In watchOS 3, the PassKit framework (PassKit.framework
) adds support for in-app payments on Apple Watch. In-app payments allow users to securely provide payment and contact information to pay for physical goods and services.
Specifically, PassKit introduces the new PKPaymentAuthorizationController
class, which presents an interface in which the user can authorize a payment request, and the PKPaymentAuthorizationControllerDelegate
protocol, which you implement to respond to user interaction with the payment authorization controller object. To learn about additional changes in the PassKit framework, see PassKit.
Enhancements for Workout Apps
In watchOS 3, workout apps can run in the background. To enable your workout app to run in the background and access HealthKit data, you must add the WKBackgroundModes key to your Info.plist
file and give it the value workout-processing
.
You can also launch your watchOS workout app from your iOS app. In your iOS app, call the new startWatchAppWithWorkoutConfiguration:completion:
method to launch (or wake up) your workout app on the paired Apple Watch. To learn about additional API changes in the HealthKit framework, see HealthKit.
WatchKit Framework Enhancements
In addition to classes that support background tasks (described in Background Tasks), the WatchKit framework (WatchKit.framework
) also includes the following enhancements:
The new
WKCrownSequencer
class gives you information about the current state of the digital crown and the newWKCrownDelegate
protocol helps you implement a delegate that can receive receive notifications as the user rotates the crown.The
WKExtension
class introduces theapplicationState
method andWKApplicationState
constants, which you can use to track the runtime state of your Watch app. TheWKExtension
class also includes two methods that help you schedule background tasks:scheduleBackgroundRefreshWithPreferredDate:userInfo:scheduledCompletion:
andscheduleSnapshotRefreshWithPreferredDate:userInfo:scheduledCompletion:
.The
WKExtensionDelegate
protocol introduces theapplicationWillEnterForeground
andapplicationDidEnterBackground
methods, which help you monitor app state changes and thehandleBackgroundTasks:
method, which tells the delegate when the app has received a background task.The new
WKGestureRecognizer
class is the base class for four concrete subclasses that you can use to access the state of the gesture recognizer and perform custom actions. To learn how to use the concrete subclasses, seeWKLongPressGestureRecognizer
,WKPanGestureRecognizer
,WKSwipeGestureRecognizer
, andWKTapGestureRecognizer
.The new
WKInterfaceHMCamera
class gives you access to an interface object that includes a representation of data from a HomeKit IP camera.The new
WKInterfaceInlineMovie
class lets you display a poster image for your video that’s replaced by video playback when the user taps the image.The new
WKInterfacePaymentButton
class lets you provide an Apple Pay payment button in your interface. (To initiate a payment request, you must connect the button to a custom action method.)The new
WKInterfaceSCNScene
class gives you an interface object you can use to manage SceneKit content for display in your app.The new
WKInterfaceSKScene
class defines an object you can use to manage a SpriteKit scene in your app.
Watch Connectivity Framework Enhancements
The WCSession
class introduces the hasContentPending
property, which indicates whether the session has data received in the background that still needs to be delivered to the delegate. WCSession
also defines the remainingComplicationUserInfoTransfers
property, which indicates the remaining number of times you can send complication data from your iOS app to your WatchKit extension.
Security and Privacy Enhancements
watchOS 3 introduces several changes and additions that help you improve the security of your code and maintain the privacy of user data. To learn more about these items, see https://developer.apple.com/security/.
App Transport Security (ATS) will be required at the end of 2016 for all network connections outside of a web view. Upcoming policy improvements to ATS include requiring forward secrecy and Transport Layer Security (TLS) v1.2 with SHA-2.
The SecKey API includes improvements for asymmetric key generation. Use the SecKey API instead of the deprecated Common Data Security Architecture (CDSA) APIs.
Starting at the end of 2016, the SSLv3 cryptographic protocol and the RC4 symmetric cipher suite will no longer be supported. It’s recommended that you stop using the SHA-1 and 3DES cryptographic algorithms as soon as possible.
You must statically declare your app’s intended use of protected data classes by including the appropriate purpose string keys in your
Info.plist
file. For example, you must include the NSCalendarsUsageDescription key to access the user’s Calendar data. If you don’t include the relevant purpose string keys, your app exits when it tries to access the data.
Existing Frameworks Now Available in watchOS
watchOS 3 includes several frameworks that currently exist on other platforms.
The SceneKit framework (SceneKit.framework
) lets you integrate 3D models into your app’s UI. SceneKit combines a high-performance rendering engine with a high-level, descriptive API and supports the import, manipulation, and rendering of 3D assets.
Use the WKInterfaceSCNScene
class to add live 3D rendered content to your watchOS app or game. In the WatchKit interface, display content by assigning an SCNScene
object, which is loaded from a .scn
file created in Xcode and bundled in your Watch app’s resources.
SceneKit in watchOS supports most of the features you use on other platforms, including lighting and shading, animation, physics, and particle systems, with the following exceptions:
3D spatial audio implemented using
SCNAudioSource
orSCNAudioPlayer
. Instead, useplayAudioSource:waitForCompletion:
or the WatchKit sound or haptic APIs.Custom Metal or OpenGL shader programs implemented using
SCNProgram
orSCNTechnique
. Instead, customize SceneKit rendering with shader modifiers (to learn more, seeSCNShadable
).Core Image filters for node rendering implemented using the
SCNNode
filters
property. Instead, customize rendering with shader modifiers (seeSCNShadable
).The physically-based material and lighting and HDR camera effects introduced in iOS 10, tvOS 10, and OS X v10.12.
The SpriteKit framework (SpriteKit.framework
) is a graphics rendering and animation infrastructure that you can use to animate arbitrary textured images, also known as sprites.
Use the WKInterfaceSKScene
class to add interactive 2D animation to your watchOS app or game. In the WatchKit interface, display content by assigning an SKScene
object, which is loaded from a .sks
file created in Xcode and bundled in your Watch app’s resources.
SpriteKit in watchOS supports most of the features you use on other platforms, including actions, physics, lighting, and particle systems, with the following exceptions:
3D spatial audio implemented using
SKAudioNode
. Instead, useplaySoundFileNamed:waitForCompletion:
or WatchKit sound or haptic APIs.Video playback implemented using
SKVideoNode
. Instead, useWKInterfaceMovie
.Core Image filters, such as those provided by
filter
,textureByApplyingCIFilter:
, andtransitionWithCIFilter:duration:
. Use theSKShader
class and built-inSKTransition
effects to customize node rendering.
The AVFoundation framework (AVFoundation.framework
) helps you manage and play audio.
The CloudKit Framework (CloudKit.framework
) provides interfaces for moving data between your app and your iCloud containers.
The Core Audio framework (CoreAudio.framework
) provides data types that help you represent audio streams, complex buffers, and time values.
The GameKit framework (GameKit.framework
) helps you create great social games.
Additional Framework Enhancements
In addition to the major changes described above, watchOS 3 includes many other improvements.
Core Data
The Core Data framework (CoreData.framework
) includes the following enhancements:
NSPersistentStoreCoordinator
now maintains a connection pool for SQLite stores. RootNSManagedObjectContext
objects (those without parent MOCs) transparently support concurrent fetching and faulting without serializing against each other.NSManagedObjectContext
objects with SQLite stores in WAL journal_mode support a new feature called query generations. These allow a MOC to be pinned to a version of the database at a point in time and perform all future fetching and faulting against that version of the database. Pinned MOCs are moved to the most recent transaction with any save, and query generations do not survive the process's life time.The new
NSPersistentContainer
class provides your app with a high-level integration point that maintains references to yourNSPersistentStoreCoordinator
,NSManagedObjectModel
, and other configuration resources.Core Data now has tighter integration with Xcode and automatically generates and updates your
NSManagedObject
subclasses.NSManagedObject
includes several additional convenience methods, making it easier to fetch and create subclasses.NSManagedObject
subclasses that have a 1:1 relationship with an entity now supportentity
.Core Data introduces several API adjustments that provide better integration with Swift, including parameterized
NSFetchRequest
objects.
For more information, see Core Data Framework Reference.
Core Motion
The Core Motion framework (CoreMotion.framework
) includes the following enhancements:
The new
CMSignificantElevationSample
class represents a sample in which there has been a significant change in the user’s elevation.The new
CMPedometerEvent
class represents an event that marks a change in the user’s pedestrian activity. You can use this class to receive real-time notifications when users pause and resume while they’re walking and running.
Foundation
The Foundation framework (Foundation.framework
) contains many enhancements, such as:
The new
NSDateInterval
class defines a programmatic interface for calculating the duration of a time interval and determining whether a date falls within it, as well as comparing date intervals and checking to see whether they intersect.The
NSLocale
class defines many new properties that you can use to get information about a locale and how it can be displayed.The new
NSMeasurement
class helps you convert measurements into different units, and calculate the sum or difference between two measurements. The newNSMeasurementFormatter
class helps you create localized representations of measurements when displaying quantities of units to the user.The new
NSUnit
class and concreteNSDimension
subclasses help you represent specific units of measure.
HealthKit
In addition to additional support for workout apps (to learn more, see Enhancements for Workout Apps), the HealthKit framework (HealthKit.framework
) includes the following changes and enhancements:
The new
HKWorkoutConfiguration
class, which lets you specify theactivityType
andlocationType
for a workout.The new
HKWheelchairUseObject
characteristic object type and the relatedHKHealthStore
methodwheelchairUseWithError:
.New metadata keys that indicate weather types, such as
HKWeatherConditionClear
andHKWeatherConditionCloudy
, and workout types, such asHKWorkoutActivityTypeFlexibility
andHKWorkoutActivityTypeWheelchairRunPace
.
HomeKit
The HomeKit framework (HomeKit.framework
) supports camera and doorbell accessories and introduces many new APIs that help you:
View and interact with IP camera accessory profiles, display live streams and snapshots, and control a camera’s settings, speaker, and microphone
Access new services and characteristics
For the primary service, link services and valid values to provide more context and configuration about the accessories
To learn more, see HomeKit Framework Reference.
PassKit
In watchOS 3, the PassKit framework (PassKit.framework
) supports in-app payments on Apple Watch (to learn more, see Apple Pay Enhancements). In addition, the framework includes several classes that were available on other platforms, such as PKPayment
, PKPaymentMethod
, PKPaymentRequest
, and PKPaymentToken
.
UIKit
The UIKit framework (UIKit.framework
) includes the following changes:
The new
preferredFontForTextStyle:compatibleWithTraitCollection:
andpreferredFontDescriptorWithTextStyle:compatibleWithTraitCollection:
methods help you adopt Dynamic Type in labels, text fields, and other text areas.The
colorWithDisplayP3Red:green:blue:alpha:
andinitWithDisplayP3Red:green:blue:alpha:
methods support Wide Color.The
UILocalNotification
class is deprecated. Use the APIs of the User Notifications framework (UserNotifications.framework
) instead.
Copyright © 2017 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2017-09-19