0

I m trying to work on WCSession default instance. But it gives the following complier issue. When I try to read as vairable

When I try to read as method

Compiler suggests as method

Defination of default Instance When I jump to definition

sant05
  • 418
  • 7
  • 21

1 Answers1

0

Try this:

var session : WCSession!

func startSession() {
    if WCSession.isSupported() {
        session = WCSession.default()
        session.delegate = self
        session.activate()
    }
}

Call startSession() wherever you want to activate your WCSession. Preferably in AppDelegate and ExtensionDelegate.

Zachary Bell
  • 559
  • 4
  • 18