3 Replies
      Latest reply on Aug 16, 2019 6:15 AM by jhkhkhjkhjkjkjk
      the_iOSBrett Level 1 Level 1 (0 points)

        Hi,

         

        I am jumping into WatchOS6 never having used previous versions of WatchOS, I do have years of experience with ObjC / Swift / Xcode though.  I am trying to create an independent Watch App and have started with the Networking by dragging over the code from my main App into the WatchKit Extension target.  I cannot get it to compile due to "No such module CFNetwork" error at the import CFNetwork statement in the file where I use CFNetwork to compare the errors such as CFNetworkErrors.cfurlErrorNotConnectedToInternet.

         

        According to docs CFNetwork is available on WatchOS 2.0+ and I have added CoreServices.framework and MobileCoreServices to the target.

         

        Am I doing anything obviosly wrong here?

         

        Cheers,

        Brett

        • Re: WatchOS6 missing module CFNetwork
          emfie Level 1 Level 1 (0 points)

          I got exactly the same issue. CFNetwork should be importable after WatchOS 2.0 but it seems not to be in the list of frameworks. I'm also running the xcode beta version.

          • Re: WatchOS6 missing module CFNetwork
            jhkhkhjkhjkjkjk Level 1 Level 1 (0 points)

            Hi! I'm also having problems with CFNetwork in watchOS 6 beta 6. I'm using URLSessionWebSocketTask and the app seems to crash because it's missing access to something in the CFNetwork framework.


            This is a simplified version of my code:

            let url = URL(string: “ws://127.0.0.1:8080”)!
            let urlSession = URLSession(configuration: .default)
            let task = urlSession.webSocketTask(with: url)
            self.webSocketTask = task
            task.resume()
            
            

             

            (I've set up a local websocket server, but also tried with public websocket 'echo' servers)

             

            When trying to connect with the code above, the app crashes and I don't get any error messages in the "Debugger output", but I do get the following output in the "Debug navigator":

             

            CFNetwork`___lldb_unnamed_symbol9369$$CFNetwork:

            [... Lots of instructions ....]

            os_log_type_enabled

                0x4286c54a <+446>:  testb  %al, %al

                0x4286c54c <+448>:  jne    0x4286c6b3                ; <+807>

                0x4286c552 <+454>:  movl   %esi, (%esp)

                0x4286c555 <+457>:  calll  0x428e87de                ; symbol stub for: objc_release

                0x4286c55a <+462>:  movl   -0x30(%ebp), %eax

                0x4286c55d <+465>:  movl   0x250292bf(%eax), %eax

                0x4286c563 <+471>:  movl   (%ebx,%eax), %eax

            ->  0x4286c566 <+474>:  movl   (%eax), %ecx

            [... Lots of more instructions ....]

             

            And on the left hand side in xcode, it says


            0___lldb_unnamed_symbol9369$$CFNetwork

            I've tried lots of things like variations on the code, trying to import the CFNetwork framework with no luck.

            If I understand this correctly "lldb_unnamed_symbol" is becuase the app is missing a library it's trying to use.

            So it seems to me like the implementation of URLSession (which is new in watchOS 6) is incomplete in some way that's connected to the CFNetwork framework

            Any Apple people here to help out?