0

I try use WatchManager.swift in exists project.

import Foundation
import WatchConnectivity

class WatchManager: NSObject, WCSessionDelegate {


    func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) {

    }

    func sessionDidBecomeInactive(_ session: WCSession) {

    }

    func sessionDidDeactivate(_ session: WCSession) {

    }
}

but I have trouble on build my project

Swift Compiler Error Group - Type 'WatchManager' does not conform to protocol 'WCSessionDelegate'

Also in issue navigator i see error

Candidate has non-matching type '(WCSession, WCSessionActivationState, Error?) -> ()'

I already tried:

  • remove derived data
  • clean project
  • clean builds folder
  • reload project from git
  • copy file from another project
  • create new file and rename it
  • build project on another mac

but i get this error everytime

BUT! If I will create new project and add watchOS target and create new file with this code - project will build successfully.

Why? How i can try to add WCSessionDelegate in my exists project?

I use Xcode9.2, swift4.0

TyM6JIep
  • 406
  • 8
  • 23

1 Answers1

0

Oh... Thank @Sameer for answer

WCSessionDelegate has required method

public func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?)

but my project there is my custom class with name Error

that's why the compiler produced an error that does not conform to protocol

TyM6JIep
  • 406
  • 8
  • 23