How can I test a standalone watchOS application? - xcode

I can't figure out how to test running my watchOS app as a standalone app. When I run it on the simulator it never works unless I also have the associated iOS app. Running the watch scheme shows that the iOS app is running along with the watchOS app. I created a scheme which just builds the watch and it will cause the watch app to start, but it doesn't actually update the compiled binary.

First of all, you have to create certificates for all project targets and upload on Testflight, Through Testflight (mobile application) you can install the app and it will sync automatically in the watch.
The second option will, Connect your watch with mobile and install that watch application via Xcode on mobile, it will sync automatically in the watch.

Related

how to build connection between independent watch app and companion iOS app?

I created a project with "iOS App with Watch App" template in XCode11(beta5), the project setting item - "Supports Running Without iOS App Installation" has been selected by default. The official doc shows that independent watch app can still use WatchConnectivity framework to transfer data, so I did it but it didn't work on simulator. I captured the error info with "Companion app is not installed". But it works When I uncheck "Supports Running Without iOS App Installation" (become dependent watch app).
How can I use WatchConnectivity to communicate between Watch & iPhone simulator when watch app is independent?

How to force an app to simulate in iPhone simulation using an iPad using Expo?

I'm currently using Expo to build an iPhone app.
I'm not supporting iPad and I have it so when it builds on iPad it runs in an iPhone Simulation.
The problem is I can't develop with Expo using this approach.
The app shows up as an iPad app, but this is not the mode being shipped to users.
According to this I might have some luck adding ios.supportsTablet to the app.json file and setting it to false but it didn't change anything.
Is there another configuration value I'm missing to force iPhone simulation mode on an iPad?
I'd rather not eject if I don't have to.
According to this, there currently isn't a way to live develop using "iPhone mode" on an iPad.
The Expo Client app can’t change its tablet support on the fly,
unfortunately, so it will always adapt your project to the iPad
viewport.
So, following the above forum here is how you get around it:
Run exp build:ios -t simulator
Open Simulator
Select Hardware/Device/iOs 11.x/iPad x generation
Unpack the generated build from the first command
You should have a file named yourApp.app
Drag that file into the iPad you are running in Simulator
It will install the app on the device and you can then view your creation
This is faster than doing a whole build cycle with TestFlight just to see your changes.
But it still leaves a bit to be desired.

Archive Watch app application without iOS application

Ive builded a watch application for OS 2.x, and i wanted to submit the watch app to the app store without the iOS application. how can i do that ? what targets do i need to remove and so i can send the watch app standalone app without iOS ?
Do i have to submit both of them and apple will decide to take the apple watch application without iOS app ?
i tried to remove iOS application from targets. then the app stopped running on simulator. and couldn't be archived.
You can't do it. A watchOS application doesn't currently exist without a corresponding iOS application. If you are only updating the watch app, you still have to resubmit the whole thing, and the version of the iOS app must be incremented as well.

Debugging Apple Watch and iOS app simultaneously

Up until today, I've been able to build, run, and debug my watch app and iOS app at the same time. When I build and run, the debugger attaches to the watch automatically. Then I have to manually attach the iOS debugger. I have been following these steps and they always worked perfectly. I can hit breakpoints on both on the watch and the phone (which is what I need to do to be able to debug things like sendMessage or applicationContext).
The problem now is that when I go to attach the iOS app to the debugger manually (via Debug -> Attach to Process), it doesn't show up in the likely targets or in applications at all, even though the app is running on the phone.
I checked my schemes and made sure that the targets were still correct- they are.
I even tried Debug -> Attach to Process with PID or Name. When I try to attach the iOS app by name, I get an error saying Will install Watch App called with bad bundle identifier '(null).
Why is my iOS app no longer a likely target? How can I get it to attach to the debugger again while my watch app is also attached?
I use another way to debug on watch app and iPhone app at the same time. I run this script when watch and iPhone simulators are running on my Mac. Then launch my watch app or iPhone app on the same simulators. I can observe both log at the same time.
P.S. These log are come from console, so you should use NSLog(), not print().

How to solve this error in Xcode when testing your app on the Apple Watch

I've tested my Apple Watch app on the simulator and it runs perfectly...However I couldn't test my app on the actual Apple Watch device:
I ran my iPhone app in Xcode.... Once completed it will install the app on Apple Watch.
Then, Apple watch app will launch and stuck on launching screen with "loading" spinner on the Apple Watch device.
The Apple watch will just close itself and this error will appear in Xcode:
You need to run the your iphone app scheme not the watchapp or extension scheme, once you will installed your iOS application on your device with watch kit support.
After installing the iPhone, you need to check your watch, application will automatically installed on Watch. If still you are not able to see the application then you need to visit application "Apple Watch" and scroll down to see your application and turn on apple watch support for your application.
If you are running the Watch OS2 app then after deploying the app on the Watch, you will need to reboot the Watch. Once rebooted, the Watch app will now run and not stuck anymore, loading time is about a few seconds only.

Resources