Can someone from Xamarin please, please take a look at the developing for the Apple Watch?

EasyGoingPatEasyGoingPat GBMember ✭✭✭

I hate to be so negative but, having spent literally weeks trying to get a Xamarin application to deploy to a physical Apple Watch, I believe that this is not currently possible. To speak even more frankly, I think this 'feature' should either be removed from Xamarin or properly supported.

For over a year, I have been working around various Xamarin foibles on a new tech startup project that is literally the difference between my having a future and not. So, when I chose to put my faith in Xamarin, the stakes could not have been higher.

Initially, I paid the full whack for a Xamarin licence. Both before and after Microsoft bought Xamarin, I have generally been satisfied with the support I have received, both here on this forum and from Xamarin. But the Apple Watch support is a different story. To be fair, I have received help from various people with this, but the fact remains that here I am, six months after first looking into the Apple Watch on Xamarin, with my whole project and future dead in the water.

I have followed every single guide and troubleshooter out there. I just cannot get a Xamarin application to go on to a physical Apple Watch. I managed it just once. I even hit a breakpoint in the debugger on the PC! I thought, "Great! Now I can begin work tomorrow morning." The following morning, without touching a line of code or a single setting, the whole thing was broken again. And I have never got it going since that day, which was about two months ago now.

Generally, I remain impressed by Xamarin, but , please, please, please can someone take a look at the deployment of code on to a physical Apple Watch? It is unusable as it stands. And therefore, as it stands, my new business doesn't have a chance and I am forced to admit that my time might have been better spent simply learning to use XCode on the Mac.

Yours desperately - A Loyal Xamarin Developer

Best Answer

  • EasyGoingPatEasyGoingPat GB ✭✭✭
    Accepted Answer

    Working with Michael Clemens from Microsoft, the Apple Watch connection is now possible. It can still be tediously fragile but I can get it to work. The workaround solution appears to be this:

    1. Power up PC, Mac and iPhone but leave Watch off.
    2. Turn off wifi on iPhone. (Yes, you read that right! Disable the wifi connection on your iPhone.)
    3. Ensure the option to debug over wifi is disabled in Visual Studio on PC and in XCode on the Mac.
    4. Plug the iPhone into the Mac via USB.
    5. Now power-on the Watch (note I did this with the Watch off power cradle then placed it on cradle; not sure if this matters)
    6. Wait until the Watch appears with its full name in Devices and Simulators in XCode.
    7. Back in VS on PC, disconnect and reconnect the Mac.

    Watch now appears as a run-target and works.

Answers

  • LandLuLandLu Member, Xamarin Team Xamurai

    Firstly, I want to say Xamarin is definite a good choice for developing iOS projects. And Microsoft is trying his best to make it better to be used for developers.
    I don't know why your Visual Studio can't deploy your Watch OS application to a real device. It may be environment related. Can you deploy a Xamarin.iOS project to a real iPhone? And if you create a blank application on XCode for Apple Watch, can it be deployed on your real watch?
    Moreover Watch application can't be independent installed on the watch. It should contain an iOS application installed on the iPhone to be paired. Have you followed this documentation to test your app https://docs.microsoft.com/en-us/xamarin/ios/watchos/deploy-test/device?

  • EasyGoingPatEasyGoingPat GBMember ✭✭✭

    @LandLu

    Hi,

    I did say that I was generally impressed with Xamarin. And, yes, it is a good choice for iOS development. My problem is specifically the support for Apple Watch.

    As I said in my post, I can deploy to a physical iPhone no problem. Yes, I do know a Watch application has to be bundled inside an iPhone application and I have got all of that set up according to the documentation.

    The problem could be environmental but a quick Google reveals many developers having problems with timeout while trying to deploy code to a physical Apple Watch. I stand by my statement that I do not currently believe that that the Xamarin support for deploying code to a physical Apple Watch is usable. If you don't believe me, please try it if you can. I would love to be proved wrong (as long as you tell me how you did it :smile: ).

    I have not recently tried a deployment from XCode. I will give that a try.

    • Patrick
  • AntHAntH GBMember ✭✭

    I feel your pain! I spent weeks and weeks going round and round trying to get a Watch app to deploy and run. I eventually got there but the crazy thing was I don't know how I fixed it because I ended up making so many changes and at some point it just started working.

    I consistently have provisioning issues (generally) and the fact that the Watch needs 2 more profiles to be tightly coupled with your app profile just makes it much harder.

  • EasyGoingPatEasyGoingPat GBMember ✭✭✭

    @AntH

    I got it working, too. Just once. I turned off for the night, rebooted the following morning, and it was broken again. I didn't touch a thing. No amount of rebooting and general p*****g about would get it working again.

    I'm currently about to try a complete format and reinstall on my MacBook build server, simply because it is something I haven't tried yet. :neutral:

    • Patrick
  • axaaxa Member ✭✭✭

    whoa, I was just about to drop a few grand on a new mac and apple watch to port my wear so app over to ios... I'm not making a dime doing any of this so I'd really like to know if apple watch development is ready for prime time or not.

    what say you Xamarin?

  • axaaxa Member ✭✭✭
    edited October 2018

    @EasyGoingPat said:
    @AntH

    I got it working, too. Just once. I turned off for the night, rebooted the following morning, and it was broken again. I didn't touch a thing. No amount of rebooting and general p*****g about would get it working again.

    I'm currently about to try a complete format and reinstall on my MacBook build server, simply because it is something I haven't tried yet. :neutral:

    • Patrick

    P, I really don't mean to belittle your efforts but out of curiosity have you been able to say take one of posted Xamarin apple watch samples and see if that deploys. I'm supposing that at least someone has deployed those samples to hardware at some point.

    So it might help you isolate if it's an environment issue or perhaps it's a code/feature issue introduced in your app. Not to say that you are doing something wrong, just maybe an issue Xamarin hasn't yet tried/found.

  • EasyGoingPatEasyGoingPat GBMember ✭✭✭

    @AntH
    @axa

    This is just my opinion...

    I'm pretty sure that you would be okay doing Apple Watch development using XCode, assuming you are happy in that environment. I'm not. Frankly, I generally hate Apple stuff, but that's a different debate. I've invested a lot of effort learning Xamarin and have a long background in professional C# development. So Xamarin was a natural choice for me.

    Generally, I find Xamarin to be a good development environment. Support is usually good, not least here on this forum, which helps with any problems that do crop up.

    But, having spent literally weeks trying to start developing for the Apple Watch using Xamarin, it is my opinion that it is not currently reliable enough to be used for serious development. I have found...

    • I can build the Xamarin-provided applications no problem.
    • Ditto my own application.
    • Provisioning is a huge pain, but that's Apple, not Xamarin's fault.
    • I can deploy to a simulated or physical iPhone reliably.
    • I can deploy to a simulated Apple Watch no problem.
    • I have managed to get my application deployed onto a physical Apple Watch less than a handful of times. I managed to hit a debugger breakpoint just once.
    • To achieve this, I did no end of rebooting and reinstalling and working through troubleshooters and guides. Randomly, it worked. Next morning, without touching a thing, it was broken again.
    • All of this appears to be no better if I try to use Visual Studio on the Mac (i.e. to eliminate the PC-to-Mac link).

    It is my belief that almost all development done by the Xamarin team is done using cloud simulators. This is the current fad by most big companies. The fact that Microsoft are pushing their own cloud services lends weight to this belief. So the provided Apple Watch example applications have indeed been tested on a simulator. I a doubt very much that any Xamarin developer has spent any significant time deploying applications to a physical Apple Watch.

    I have been getting great support from a Microsoft engineer, but unfortunately made little progress. He's checked my logs and we have exchanged tonnes of information. But, when it came to testing on a physical Apple Watch, he had to pass the problem to a different team who in turn had to wait for another engineer somewhere who had access to a physical Watch. After a couple of weeks, all this engineer could say was that the debug experience was less than ideal and suggested that I do random reboots of all devices until it works. He suggested a few other tips but mostly things I was doing already.

    So, bottom line is, here I am, weeks into a project that cannot proceed without some code running on a physical Apple Watch, and I haven't written a single line of code to run on the Watch. And, to be honest, I don't even feel like I am closer to a solution. That's scary as hell, unbelievably frustrating, and a situation I have not encountered in thirty years of getting computers to talk to some very uncooperative pieces of hardware.

    I hate to be so negative, but I really do think this needs looking at as a matter of some urgency if Xamarin wants to be a player in the coming boom in wearable development.

    • Patrick
  • axaaxa Member ✭✭✭
    edited October 2018

    @P
    I am finding myself in a not too dissimilar situation and can empathize with you.
    Thing is from what Ive seen presentations back to 2014/15 proclaim apple watch support in Xamarin, and finding the wearable market heavy apple has made itself a requirement.
    Hopefully support is prioritized and we see some progress sooner than later.

  • ElvisXiaElvisXia Member, Forum Administrator, Xamarin Team Xamurai

    This is an issue that has been raised on Github: https://github.com/xamarin/xamarin-macios/issues/4345. So it turns out what do the trick is to make sure the watch trusts the computer and make sure debugging is enabled for the watch app project, and keep the watch awake when deploying.

    So, for anyone who's suffering from Apple watch deployment, please follow steps below:

    1. Make sure your iPhone is plugged in, and the Watch is already paired with the iPhone.
    2. Ensure the configuration is set to Debug or Debug | iPhone (if available) or Release (if you do not want to debug)
    3. Right-click on the watch project and choose Set As Startup Project.
    4. Ensure the connected Watch device is selected in the target list.
    5. Click the Run button (or choose a Start option from the Run menu).
      6, The solution will build and the iOS app will be deployed to the iPhone and the watch app will be deployed to the watch (this can be very slow). If the iOS app or watch extension provisioning is not set correctly then deployment to the iPhone will fail.
    6. You need to keep the watch awake until the watch app starts.
      If deployment completes successfully, your app icon will appear on the watch screen with a circular installing progress indicator.
    7. If the watch app is successfully installed, the watch app should launch and you can start debugging (if Debug configuration was selected).

    If the steps doesn't work for you. Then it could be a very specific problem related with native environment. You can reach out to https://visualstudio.microsoft.com/vs/support/ to get support from Microsoft Support Engineers.

  • EasyGoingPatEasyGoingPat GBMember ✭✭✭

    @ElvisXia

    Thanks for having a look.

    I was aware of the GitHub issue and have worked through all of that many times. I can't believe it has been closed.

    I have raised this with Microsoft and they have gone as far as looking at my logs and not found anything obviously wrong. And - without wishing to sound harsh - nothing I have read above or on the GitHub issue gives me any hope that I am going to succeed at this any time soon. I have been at this literally weeks and got nowhere.

    I will of course go through it all again, letter by letter. But with all due respect, no one has ever offered an explanation why I would one day manage to get everything working then the following morning find it broken again. That is simply not normal behaviour for any computer system and certainly not a development environment.

    I'll update this thread as soon as I have chance to have a fresh go at this. One thing I have done is a reformat and reinstall of OSX on my build server. I did this out of sheer desperation but maybe it will clear a dodgy setting or cache file somewhere.

    Thanks again for looking at this.

    • Patrick
  • EasyGoingPatEasyGoingPat GBMember ✭✭✭

    @ElvisXia

    Running through your instructions on a fresh install of OSX, XCode and Visual Studio, I can't do step #6 because the physical watch doesn't appear as a run target on the PC. This is despite the fact that it can be seen no problem from XCode on the Mac.

    Time to reopen my support case with Microsoft, I think.

    If I make progress, I'll update this thread to help others.

    • Patrick
  • ElvisXiaElvisXia Member, Forum Administrator, Xamarin Team Xamurai

    @EasyGoingPat

    Thanks for sharing the information. Hope you can fix the issue soon. I'll keep monitor this thread.

  • EasyGoingPatEasyGoingPat GBMember ✭✭✭
    Accepted Answer

    Working with Michael Clemens from Microsoft, the Apple Watch connection is now possible. It can still be tediously fragile but I can get it to work. The workaround solution appears to be this:

    1. Power up PC, Mac and iPhone but leave Watch off.
    2. Turn off wifi on iPhone. (Yes, you read that right! Disable the wifi connection on your iPhone.)
    3. Ensure the option to debug over wifi is disabled in Visual Studio on PC and in XCode on the Mac.
    4. Plug the iPhone into the Mac via USB.
    5. Now power-on the Watch (note I did this with the Watch off power cradle then placed it on cradle; not sure if this matters)
    6. Wait until the Watch appears with its full name in Devices and Simulators in XCode.
    7. Back in VS on PC, disconnect and reconnect the Mac.

    Watch now appears as a run-target and works.

  • axaaxa Member ✭✭✭
    ridiculous.

    Curious to know if you were able to publish all the way through.
  • DennyyDennyy Member ✭✭

    Comment for visibility

  • EasyGoingPatEasyGoingPat GBMember ✭✭✭

    @axa

    I haven't tried to get anything in the App Store yet but I was able to get a debug build onto the Apple Watch and hit a breakpoint in Visual Studio.

    I'm about to go to Visual Studio 2019 so I hope nothing now breaks.

    • Patrick
  • OnurHazarOnurHazar USUniversity ✭✭✭

    @EasyGoingPat
    Hey Patrick, Is there a way to debug your watch app without WiFi? It seems the connection is slow between the watch app and phone app. It's also really slow to build&deploy the project to a real apple watch. Are you following some specific steps or doing configurations to improve deploy times? Thanks!

  • EasyGoingPatEasyGoingPat GBMember ✭✭✭

    @OnurHazar

    You can use a cable to the phone but the phone-to-watch has to be the built-in Bluetooth.

    I still haven't had chance to get to this on VS2019 yet but, yes, it was very slow on VS2017.

    • Patrick
  • OnurHazarOnurHazar USUniversity ✭✭✭

    To Xamarin Devs,

    I can deploy and debug my watch app after waiting 10 mins (every time) or so (because it tries to copy the files to watch over wifi). Checking incremental builds option sometimes causes deployment issues (see the troubleshooting link below) so I had to uncheck. https://docs.microsoft.com/en-us/xamarin/ios/watchos/deploy-test/device#troubleshooting

    Once I deploy the watch app, the debugging performance is very bad. Watch messages are sent/replied very slowly. Without debugging, communication between them is much more faster.

    @EasyGoingPat
    I found some steps to make the debugging process faster but its for Xcode.
    https://stackoverflow.com/questions/34695235/debugging-on-real-apple-watch
    https://stackoverflow.com/questions/31741744/debug-watchkit-on-real-apple-watch-nothing-happens?rq=1

    They are attaching to process after deploy, I saw that VS for Mac doesn't support "attach to process" for running iOS app which makes me sad.

    Plus, you can't debug iOS project & watch project at the same time which is annoying. Is there anyone who tried these steps written in the link and achieved multi process debugging? https://docs.microsoft.com/en-us/xamarin/cross-platform/deploy-test/multi-process-debugging

    I have ran out of options. Please give some guidance on that. Currently, I write console writelines everywhere in my code to see how the code flows. I really need to debug my watch app properly in my REAL apple watch.

  • OnurHazarOnurHazar USUniversity ✭✭✭

    --Update--

    I can debug iOS project & watch project at the same time by following the steps in the link below;

    https://docs.microsoft.com/en-us/xamarin/cross-platform/deploy-test/multi-process-debugging

Sign In or Register to comment.