3 Replies
      Latest reply on Feb 7, 2020 2:13 PM by jasonmolenda
      nfarah86 Level 1 Level 1 (0 points)

        I'm going to link my recent response to this thread (see below):


        I'm working with CoreBluetooth- and can't debug over simulator.  When I run a simple app that writes to a label, I see my debug statements on the console when deploying to a simulator. The minute I switch over to a real device, I can't debug and breakpoints don't even work. The funny thing is my watch os app is still updated. The real problem is how to effectively debug on Xcode when using a real device. I've updated Xcode, and all my software. I paired and unpaired my device. Downloaded the profile for watch os on my phone. Nothing is working.  I'm on watch OS 6.1.1, Xcode 11.3.1.  If there is some solution that I missed, I'll be happy to try. Apple doesn't cover this bug or incident on their docs or how to solve.  I want to be able to see my logs, even if my app doesn't crash.


        EDIT: Preface, a few days ago when I was working in CoreBluetooth and building an app, the console on Xcode worked- I was able to see all my devices, debug statements, and such when I deployed to a real device. Even when not working in CoreBluetooth and just building a simple app, the debug statements worked on the console when I deployed it to a real device.


        Other steps I've taken:


        • Went to Debug --> attach process by PID (didn't work)

        • Windows -> Device/Simulators (can only see when something crashes on the console- but no debug statements)

        • Deleted derived data (edit)


        It's just recently, like last night, I ran into this problem. I can't find the solution or understand WHY this is happening.


        Reference post



        Please let me know if I need to include any other pertinent information. Thanks !!


        • Re: Debug statements when deployed to a real device doesn't work for watch os
          nfarah86 Level 1 Level 1 (0 points)

          Update: The only real workaround is not ideal and not sustainable, but temporary fix. Write your code for iOS and debug there, and translate your app to the watch os workflow. (I'm building a watch os-only app).  Apple needs to figure out why this is happening or else connected products for watchOS will be a real nightmare to make and deter anyone from pushing IoT - like apps to the Apple store.

          • Re: Debug statements when deployed to a real device doesn't work for watch os
            jasonmolenda Apple Staff Apple Staff (0 points)

            Hi, I'm not sure what's happening with this setup, but maybe we can narrow down what might be happening.


            I'd start by creating a template Watch app in Xcode - just an empty app, put a breakpoint on viewDidLoad.  Does this launch reliably on your watch?  Does it hit the breakpoint?  Can you finger-launch the app on the watch, and then Debug > Attach to Process and attach to the already-running app on the watch?


            The use of CoreBluetooth shouldn't impact debuggability.  But maybe we can start with the most basic app and see what works / what does not work with this.


            For what it's worth, when I'm trying to follow app launch process, I like to open the debug tab in Xcode and look for the performance monitor graphs - when those are updating, the app is running under the debugger on the device.