其他 watchOS 3 框架更改Additional watchOS 3 Frameworks Changes

本文介绍了 watchOS 3 的现有框架的附加、小更改或增强功能。This article covers additional, minor changes or enhancements to existing frameworks for watchOS 3.

除了对 iOS 的重大更改之外,Apple 还在 watchOS 3 中对多个现有框架进行了修改和改进。In addition to the major changes to iOS, Apple has made modifications and improvements to several existing frameworks in watchOS 3.

核心数据Core Data

以下对用于监视操作系统3的核心数据框架进行了以下改进:The following enhancements have be made to the Core Data framework for watch OS 3:

  • NSManagedObjectContext对象支持并发错误和不序列化的提取。Root NSManagedObjectContext objects supports concurrent faulting and fetching without serialization.
  • NSPersistentStoreCoordinator类维护 SQLite 数据存储的池。The NSPersistentStoreCoordinator class maintains a pool of SQLite data stores.
  • 在 WAL 日志模式下,具有 SQLite 数据存储的NSManagedObjectContext对象支持新的查询生成功能,在该功能中,托管对象上下文(MOC)可以固定到特定数据库版本,以供将来获取和出错事务。The NSManagedObjectContext objects with SQLite data stores in the WAL Journal Mode support the new query generation feature where Managed Object Contexts (MOC) can be pinned to specific database versions for future fetching and faulting transactions.
  • 使用高级 NSPersistenceContainer 引用 NSPersistentStoreCoordinatorNSManagedObjectModel和其他核心数据配置资源。Using the high-level NSPersistenceContainer to reference the NSPersistentStoreCoordinator, NSManagedObjectModel and other Core Data configuration resources.
  • 添加了几个新的便利方法,NSManagedObject 更轻松地执行提取和创建子类。Several new convenience methods have been added to NSManagedObject making it easier to perform fetches and create subclasses.

有关详细信息,请参阅 Apple 的核心数据框架参考For more information, please see Apple's Core Data Framework Reference.

核心动作Core Motion

针对观看 OS 3 的核心运动框架进行了以下改进:The following enhancements have be made to the Core Motion framework for watch OS 3:

  • 新的设备运动事件使用加速感应和陀螺仪来提供运动和方向更新。The new Device Motion event uses the accelerometer and gyroscope to provide motion and orientation updates. 应用可以注册此更新(速率为100Hz)。The app can register for this update (at rates of up to 100Hz).
  • 当用户暂停和继续运行时,新的 Pedometer 事件可实现快速实时通知。The new Pedometer event enables fast, real-time notifications when the user pauses and resumes running. 使用CMPedometer注册前台或后台 pedometer 事件。Use the CMPedometer to register for foreground or background pedometer events.

FoundationFoundation

已对监视 OS 3 的基础框架进行了以下改进:The following enhancements have be made to the Foundation framework for watch OS 3:

  • 使用新的NSDateInterval类可以进行日期和时间间隔计算,如持续时间,用于比较间隔和测试间隔交点。Use the new NSDateInterval class to make date and time interval calculations such as durations, for comparing intervals and testing for interval intersections.
  • NSLocal类添加了几个新属性,以获取本地信息和可用的显示格式。Several new properties have been added to the NSLocal class to acquire local information and the available display formats.
  • 使用新的NSMeasurement类在不同的度量单位(UOM)之间进行转换,或对不同 UOMs 中的值执行计算。Use the new NSMeasurement class to convert between different Units of Measure (UOM) or perform calculations on values in different UOMs.
  • 使用新的NSMeasurementFormatter类来设置要向最终用户显示的本地化度量值的格式。Use the new NSMeasurementFormatter class to format localized measurements for displaying to the end user.
  • 使用新的NSUnitNSDimension类来表示特定的 UOMs。Use the new NSUnit and NSDimension classes for representing specific UOMs.

HealthKitHealthKit

HealthKit 框架对监视操作系统3进行了以下改进:The following enhancements have be made to the HealthKit framework for watch OS 3:

  • 使用 new HKWorkoutConfiguration类指定健身的 ActivityTypeLocationTypeUse the new HKWorkoutConfiguration class to specify the ActivityType and LocationType of a workout.
  • 添加了新的HKWheelchairUseObjectHKHealthStore类的 WheelchairUse 方法,以便使用与轮椅相关的运行状况数据。The new HKWheelchairUseObject and the WheelchairUse method of the HKHealthStore class have been added for working with wheelchair related health data.
  • 添加了新的元数据密钥,用于天气类型(如 HKWeatherConditionClearHKWeatherConditionCloudy)和健身类型(如 HKWorkoutActivityTypeFlexibilityHKWorkoutActivityTypeWheelchairRunPace)。New metadata keys have been added for weather types (such as HKWeatherConditionClear and HKWeatherConditionCloudy) and workout types (such as HKWorkoutActivityTypeFlexibility and HKWorkoutActivityTypeWheelchairRunPace) have been added.

HomeKitHomeKit

HomeKit 框架对监视操作系统3进行了以下改进:The following enhancements have be made to the HomeKit framework for watch OS 3:

  • 添加了查看和与 HomeKit 连接的 IP 照相机的交互功能。Added the ability to view and interact with HomeKit connected IP cameras.
  • 添加了几个新的服务和特性。Added several new services and characteristics.
  • 添加了更多上下文和配置主要服务和链接服务的附件。Added more context and configuration of the accessories of primary services and link services.

PassKitPassKit

PassKit 框架对监视操作系统3进行了以下改进:The following enhancements have be made to the PassKit framework for watch OS 3:

UIKitUIKit

UIKit 框架对监视操作系统3进行了以下改进:The following enhancements have be made to the UIKit framework for watch OS 3:

  • 为了支持标签中的动态类型,文本字段和文本框使用 UIFont 类的新 PreferredFontForTextStyle 方法。To support Dynamic Type in labels, text fields and text boxes use the new PreferredFontForTextStyle method of the UIFont class.
  • 添加了 ColorWithDisplayP3 方法来支持宽色。The ColorWithDisplayP3 method was added to support Wide Color.