HKWorkoutSessionDelagate 协议一致性
HKWorkoutSessionDelagate protocol conformity
我正在使用 xCode 8.0 Beta 将 watchOS2 升级到 watchOS3 我在使用 HKWorkoutSessionDelagate 时遇到了问题。见图。
修复建议崩溃 xcode - 遇到类似问题的任何人或任何人都可以指出解决方案的方向 - 将不胜感激。
谢谢
刚刚添加了这个委托,我没有收到任何错误。使用 Xcode 8.0,Swift 3.0.
//
// InterfaceController.swift
// asf WatchKit Extension
//
// Created by Alvin Varghese on 27/06/16.
// Copyright © 2016 Swift Coder. All rights reserved.
//
import WatchKit
import Foundation
import HealthKit
extension InterfaceController : HKWorkoutSessionDelegate
{
func workoutSession(_ workoutSession: HKWorkoutSession, didChangeTo toState: HKWorkoutSessionState, from fromState: HKWorkoutSessionState, date: Date)
{
}
func workoutSession(_ workoutSession: HKWorkoutSession, didFailWithError error: NSError){
}
}
class InterfaceController: WKInterfaceController {
override func awake(withContext context: AnyObject?) {
super.awake(withContext: context)
// Configure interface objects here.
}
override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
}
override func didDeactivate() {
// This method is called when watch view controller is no longer visible
super.didDeactivate()
}
}
我正在使用 xCode 8.0 Beta 将 watchOS2 升级到 watchOS3 我在使用 HKWorkoutSessionDelagate 时遇到了问题。见图。
修复建议崩溃 xcode - 遇到类似问题的任何人或任何人都可以指出解决方案的方向 - 将不胜感激。
谢谢
刚刚添加了这个委托,我没有收到任何错误。使用 Xcode 8.0,Swift 3.0.
//
// InterfaceController.swift
// asf WatchKit Extension
//
// Created by Alvin Varghese on 27/06/16.
// Copyright © 2016 Swift Coder. All rights reserved.
//
import WatchKit
import Foundation
import HealthKit
extension InterfaceController : HKWorkoutSessionDelegate
{
func workoutSession(_ workoutSession: HKWorkoutSession, didChangeTo toState: HKWorkoutSessionState, from fromState: HKWorkoutSessionState, date: Date)
{
}
func workoutSession(_ workoutSession: HKWorkoutSession, didFailWithError error: NSError){
}
}
class InterfaceController: WKInterfaceController {
override func awake(withContext context: AnyObject?) {
super.awake(withContext: context)
// Configure interface objects here.
}
override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
}
override func didDeactivate() {
// This method is called when watch view controller is no longer visible
super.didDeactivate()
}
}