6 Replies
      Latest reply: Sep 21, 2016 7:42 AM by Ivang1976 RSS
      Ivang1976 Level 1 Level 1 (0 points)

        My app was working correctly with swift 2.2 in xCode 7 but after upgrade my xCode to 8 version and migrate swift to 3.0, I founded this error in my WCSeesionDelegate

         

        class WatchSessionManager: NSObject, WCSessionDelegate {
             @available(watchOS 2.2, *)
             public function session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?)
             {
             }
        

         

        Type "WatchSessionManager" does not conform to protocol "WCSessionDelegate"

         

        After that error I added the mandatory functions and then I founded this errors

         

        
        class WatchSessionManager: NSObject, WCSessionDelegate {
             @available(iOS 9.3, *)
             public func sessionDidBecomeInactive(_ session: WCSession)
             {
             }
        Cannot override "sessionDidBecomeInactive" which has been marked unavailable
        
             @available(iOS 9.3, *)
             public func sessionDidDeactivate(_ session: WCSession)
             {
             }
        Cannot override "sessionDidDeactivate" which has been marked unavailable
        
             @available(watchOS 2.2, *)
             public function session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?)
             {
             }
        

         

        Any idea?

        • Re: Migrating app from Swift 2.2 to 3.0 with WCSessionDelegate
          eskimo Apple Staff Apple Staff (7,835 points)

          The following works fine when I paste it into a newly created iOS project.

          import WatchConnectivity
          
          class WatchSessionManager: NSObject, WCSessionDelegate { 
              public func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) 
              { 
              }
          
              func sessionDidBecomeInactive(_ session: WCSession) {
              }
          
              func sessionDidDeactivate(_ session: WCSession) {
                  session.activate()
              }
          }
          

          I suspect you’re tripping over availability problems.  Do you get these errors when building the iOS side or the watchOS side?

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"