UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

How to debug an Apple watch and an iPhone app at the same time?

Forums > SwiftUI

@Apps  

I have this app that uses Apple watch at the same time.

It needs to know when the watch app is running. The user taps a button on the watch and a message is send back to the iPhone application for processing.

Apple don't give a crap to explain how to debug something that needs debugging at the same time, watch and iPhone and the process I have discovered, after digging on the web is this:

  1. Using Xcode you select the scheme YourAppWatch > Apple Watch via iPhone and run your watch application on device. The app stays visible for a few seconds and the watch sleeps. That is annoying as hell. You have to keep tapping on the watch to prevent it from sleeping. For heavens sake, Apple, we are debugging the thing!
  2. Using Xcode again, you select the scheme YourApp > YouriPhone but you cannot run the thing. If you do, Xcode stops the app watch application!!!
  3. You go to Debug, Attach Process and select YouriPhone process. After a few seconds, Xcode says your app is running, but it is not. You have to launch your app by tapping on it. The bonus part is that it is not debugging anything. It will not stop on any breakpoint.

For the Holy Cow, is there a sane way to debug a watch and iPhone app at the same time that works?

As usual, zero stars for Apple.

2      

Hi @KatkayApps

I assume you are talking about on real devices. I know you can run multiple simulator at the same time (I have not done it between Apple Watch and iPhone but have done it between iPad and iPhone).

You need to keep in mind that the watch and phone apps are TWO app not one and even though are connected run independently of each other.

  1. Run the app on the iPhone and debug that and if no bugs
  2. Run the app on Apple Watch and then open the app in phone (not via xcode). debug that.

Keep in mind that data may not transfered straight away as the watch decide when (battery saving optimisation I think). You can see this even with Apple own app eg. Do some exercise on the watch and then quickly open the Activity app and you will see a difference between them.

You might want to read the Apple Documents on the Apple Watch (Sorry do not know the link).

2      

@twostraws  Site AdminHWS+

Hello!

I appreciate your frustration here, but please try to keep a civil tone where possible– the Apple engineers who build these tools are doing their best, and I want to make sure that folks visiting these forums don't feel put off from contributing because folks are angry.

Would you consider filing a feedback request with Apple? That might help them do better in Xcode 14 and beyond.

Paul

4      

@Apps  

Thanks NigelGee, but the problem is this: when I run the apple watch app and run the iPhone app, the watch is constantly sleeping and sending the app to background. Very annoying.

Dear Paul, after 14 years developing for iOS and seeing how Apple treat developers with subpar development tools, poorly written and incomplete documentation (136K undocumented APIs according to google), and draconian reviews, etc., one cannot resist from being angry.

As a bonus, I have filled more than 150 feedback requests all there years, from which more than half disappeared misteriously and almost none of the remainder got a solution.

But I did not curse, just added some emojis that I aready removed... 😃

2      

Hacking with Swift is sponsored by RevenueCat

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.