5 Replies
      Latest reply on Oct 11, 2019 9:59 PM by CleanCoder
      the_iOSBrett Level 1 Level 1 (0 points)



        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?




        • 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://”)!
            let urlSession = URLSession(configuration: .default)
            let task = urlSession.webSocketTask(with: url)
            self.webSocketTask = task


            (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":



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


                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


            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?

            • Re: WatchOS6 missing module CFNetwork
              gavhuang@cisco.com Level 1 Level 1 (0 points)

              I have also meet the same issue, what I did is try to migrate an iOS static library which base on CFNetwork to WatchOS. Do you have find the solution?