mirror of
https://github.com/bitwarden/mobile
synced 2025-12-05 23:53:33 +00:00
102 lines
3.7 KiB
Plaintext
102 lines
3.7 KiB
Plaintext
---
|
|
sidebar_custom_props:
|
|
access: bitwarden
|
|
---
|
|
|
|
# watchOS
|
|
|
|
:::warning Legacy
|
|
|
|
Getting started the **legacy** watchOS app done in .NET MAUI.
|
|
|
|
:::
|
|
|
|
## Requirements
|
|
|
|
Follow the [iOS Setup](../ios/index.mdx).
|
|
|
|
In order for everything to work properly **devices** are needed. On simulators the synchronization
|
|
won't work (and some other parts may not work as well). Also, have Bluetooth enabled if possible to
|
|
ease the sync between devices and the debugging communication.
|
|
|
|
It's recommended to read the
|
|
[Watch Architecture](../../../../../architecture/mobile-clients/net-maui-legacy/watchOS) as well.
|
|
|
|
## macOS Setup
|
|
|
|
Having followed the macOS setup of iOS, no additional configuration is needed given that when the
|
|
project is opened in Xcode it will automatically have the provisioning profiles set up.
|
|
|
|
## Debugging
|
|
|
|
There are two parts from where to debug:
|
|
|
|
- From Visual Studio for Mac (the iOS app)
|
|
- From Xcode (the watchOS app)
|
|
|
|
For now, there is no way to debug both apps (iOS and watchOS) at the same time given that from MAUI
|
|
there is no access to debug information of the watchOS app and from Xcode an iOS stub app is
|
|
installed on the iPhone to debug it. So, at the moment of debugging one needs to choose which part
|
|
to have information about, therefore whether to debug from VS4M or from Xcode.
|
|
|
|
:::caution
|
|
|
|
When debugging from Xcode the MAUI iOS app will be replaced with the stub one from Xcode. So any
|
|
configuration on the iOS app will be lost (like server urls)
|
|
|
|
When debugging from VS4M, uninstall the previous watchOS app (if any) from the Apple Watch in
|
|
between builds to have it always up to date (there are times that if one doesn't uninstall the
|
|
previous watchOS app it doesn't get updated)
|
|
|
|
:::
|
|
|
|
:::tip
|
|
|
|
If one needs to get the logs or use the _Console_ app to see the logs from the watch then one needs
|
|
to install the `sysdiagnose` profile for watchOS from Apple Developer site
|
|
[here](https://developer.apple.com/bug-reporting/profiles-and-logs/?name=sysdiagnose) into the
|
|
paired iPhone and after that restart both devices in order for the logs to work.
|
|
|
|
:::
|
|
|
|
### Building
|
|
|
|
Given that the MAUI iOS app needs the output of the build of Xcode, one needs to build the watchOS
|
|
app from Xcode first and then from VS4M build the iOS app to run it on the device.
|
|
|
|
The output of Xcode build is stored in a location pretty similar to the next one that is configured
|
|
in the `iOS.csproj`:
|
|
|
|
```xml
|
|
<PropertyGroup>
|
|
<WatchAppBuildPath Condition=" '$(Configuration)' == 'Debug' ">$(Home)/Library/Developer/Xcode/DerivedData/bitwarden-cbtqsueryycvflfzbsoteofskiyr/Build/Products</WatchAppBuildPath>
|
|
```
|
|
|
|
It's highly likely that the folder `bitwarden-cbtqsueryycvflfzbsoteofskiyr` won't be the same on
|
|
every Mac. So one needs to change that part in `iOS.csproj` to the one created automatically by
|
|
Xcode locally.
|
|
|
|
To know exactly which is the path: Open the Project in Xcode -> Go to Product -> Show Build Folder
|
|
in Finder.
|
|
|
|
_This needs to be improved to have a fixed location or an easier way to get it automatically._
|
|
|
|
:::caution
|
|
|
|
One needs to take special attention to target the same platform on both IDEs. Therefore when running
|
|
on a device, target the device both in Xcode and on VS4M when building so that the watchOS app is
|
|
bundled correctly. Also one needs to make sure that "bitwarden WatchKit app" scheme is selected.
|
|
|
|
:::
|
|
|
|
### Synchronization
|
|
|
|
There is no way to debug the synchronization completely at the same time for the reasons
|
|
aforementioned.
|
|
|
|
So one can debug one end (iOS) or the other (watchOS).
|
|
|
|
If needed to check something on both ends "at the same time" (like to check why a message is not
|
|
sent/arrived), one needs to use console logging or adapt part of the MAUI code to the iOS stub app
|
|
on Xcode and debug the synchronization from Xcode.
|