76

I'm a .NET developer and want to write an IOS & Android app in C#. I've had a read around Xamarin for Visual Studio which looks interesting if not a tad expensive!

Do you need a Mac to debug your code? Do you just need a networked Mac to actually deploy the app to the Store?

Is the best option just to buy a Mac and run Windows with VS in a VM or can I just use my windows machine, write & debug the code in Windows then just hook up to a networked Mac for final deployment?

Hardgraf
  • 2,566
  • 4
  • 44
  • 77

7 Answers7

46

From May 2017, you can develop app without MAC.

Microsoft Xamarin introduce a Live Player. With Live Player, iOS apps can be deployed directly onto an iPhone or other iDevice from a PC running Visual Studio, where the code can then be tested and debugged.


WARNING The Xamarin Live Player Preview has ended. But it changed Hot Reload. With this feature, you can develop iOS app with your iPhone See discussion

See this video: https://www.youtube.com/watch?v=awgZDL1a3YI

this is Live Player Get start section: Live Player

Note: The final build and submission to the App Store will still require a Mac

Device Requirements

The Xamarin Live Player app supports the following devices:

iOS

  • iOS 9.0 or later.
  • ARM64 processor.
  • Check the App Store for a list of supported devices.

Android

  • Android 4.2 or later.
  • ARM-v7a, ARM-v8a, ARM64-v8a, x86, or x86_64 processor.

Limitations

There are some limitations on the things Xamarin Live Player can run, including the items below:

  • Android user interfaces designed with AXML files are not currently supported.
  • Some iOS storyboard features are not supported.
  • iOS XIB files are not supported.
  • Custom Renderers are not supported.
  • Xamarin.Forms Effects are not supported.
  • Embedded resources are not supported (ie. embedding images or other resources in a PCL).
  • Limited support for reflection (currently affects some popular NuGets, like SQLite and Json.NET). Other NuGets are still supported.
  • Some system classes cannot be overridden (for example, you cannot implement a subclass).
  • Some platform features that require provisioning can't work in the Xamarin Live Player app (however it has been configured for common operations like camera access).
  • Custom targets and build steps are ignored. For example, tools like Fody cannot be incorporated.
ebattulga
  • 10,774
  • 20
  • 78
  • 116
  • 2
    Just a "gotcha" when I was getting started with Xamarin. As per https://blog.xamarin.com/xamarin-live-player-faq/ reflection doesn't work as you'd expect. I was pulling my hair out trying to figure out why my JSON.NET code wasn't serializing properly. It made Live Player useless to me since my app communicates with a rest api via json. – JohnB Jan 19 '18 at 04:27
  • @ElPresidente Sorry of inconvenient. I just updated my post with limitation for `live player`. – ebattulga Jan 20 '18 at 05:33
  • Does anyone know what "limited support for reflection" is supposed to mean? – Davatar Apr 16 '18 at 08:39
  • Does this mean I can write a complete GUI on my iPad Pro by using ONLY Visual Studio with Xamarin, on my Windows 10 Pro computer without buying a Mac? – Doug Null Jul 11 '18 at 04:36
  • LivePlayer is pretty poor IMO. My app has an Android splash screen and that prevents LP from working properly, and even when I removed it, it didn't really work. I would suggest either GorillaPlayer, or the Rolls Royce (in both price and functionality) is LiveXaml – Neil Aug 16 '18 at 18:53
  • 4
    **Note:** According to this [discussion section](https://learn.microsoft.com/en-us/xamarin/tools/live-player/install?tabs=windows), the iOS Live Player is dead: "We will no longer be distributing the iOS version of the Xamarin Live Player." – Anders Carstensen Oct 09 '18 at 17:47
  • 2
    I found the iOS Live Player to be dead, as well. Depending on how badly you want to feed the Beast, the cheapest, most time-saving way is to just get a $400 mac mini. Apple makes no money on these crappy machines so you aren't feeding them much and all of your headaches will largely go away. smh – Newclique Oct 23 '18 at 15:49
  • Anyone tried using macinCloud or MacStadium (required for actual App store submission) alongside XAML previewer for iOS? – niico Oct 07 '19 at 08:30
41

Yes, you must have a Mac to do Xamarin.iOS development. The Mac is required for building as well as running the iOS simulator. You can either use it as a build server, and actually do your development in Visual Studio (either in a standalone PC, or on a VM running on your Mac), or you can do your development directly on the Mac using Xamarin Studio as your IDE.

Jason
  • 86,222
  • 15
  • 131
  • 146
  • 1
    Thanks @Jason, so the best way to tackle this would be use a Mac with Windows running on a VM through Parallels etc? – Hardgraf Aug 26 '14 at 14:41
  • I personally just use the Xamarin Studio IDE, but a lot of people who love VS run it from within a VM – Jason Aug 26 '14 at 14:48
  • Ok thanks, As a C# developer I assume you think the outlay cost is worth it as opposed to learning Objective C & Java for Android? – Hardgraf Aug 26 '14 at 14:51
  • 9
    It's more than just learning Objective-C and Java. You also don't have to maintain three different code bases (assuming you're developing for Windows Phone as well). Adding new features, fixing bugs, and being able to release for all platforms at the same time is definitely worth the investment. – Mike Aug 26 '14 at 15:00
  • 3
    This guy has a nice write up on the process from an experienced perspective: http://vincenth.net/blog/archive/2014/11/18/why-and-how-to-get-started-with-visual-studio-2015-and-xamarin-forms.aspx – Paul Perrick Oct 23 '15 at 07:28
  • 6
    Please note that since this answer was given, things have changed. In mid 2017, Xamarin released the Live Player (see @ebattulga's answer) which allows "continuous development and debugging for iOS" (https://www.xamarin.com/live). Also see https://arstechnica.com/?post_type=post&p=1094721 for more information. – Christopher Brown Aug 30 '17 at 14:50
  • It's very strange we haven't any solution from Azure – alerya May 05 '18 at 18:06
28

You can use Xamarin Studio instead of Visual Studio and build iOS application by C#. First install VMware Workstation and then download OS X image and run it by VMware.

Then Install tools on it and enjoy.

Tools :

EDIT : The following links are out dated, You must install Mac OS 10.10 in order to be able to install XCode 6.

iOS Tools that you need:

1) Mac OS X image for Windows Note: Max OS X Installation Help: http://www.sysprobs.com/easily-run-mac-os-x-10-8-mountain-lion-retail-on-pc-with-vmware-image

2) Mono: http://download.xamarin.com/MonoFrameworkMDK/Macx86/MonoFramework-MDK-3.2.4.macos10.xamarin.x86.pkg

3) Xamarin Studio: http://download.xamarin.com/studio/Mac/XamarinStudio-4.2.1-1.dmg

4) MonoTouch: http://download.xamarin.com/MonoTouch/Mac/monotouch-7.0.4.209.pkg

5) Xcode

Morteza Soleimani
  • 2,652
  • 3
  • 25
  • 44
  • Yes but you need to have an actual Mac machine for the Apple iOS SDK to be present at compile no? – Hardgraf Aug 26 '14 at 14:57
  • 18
    I use WMware completely for develop and publish iOS apps , and I dont have a mac – Morteza Soleimani Aug 26 '14 at 14:58
  • 2
    @Hardgraf I edited my answer and you can find all tools that you need – Morteza Soleimani Aug 26 '14 at 15:04
  • 9
    Running OS X on non-Mac hardware (directly or in a VM) is a violation of Apple's license – Jason Aug 26 '14 at 15:11
  • Right so you can deploy to the Mac App Store using the OS X image installed on a VM using a Windows machine? Is this legal too? – Hardgraf Aug 26 '14 at 15:12
  • @MortezaSoleimani is it possible then to have Xamarin installed in a Windows PC inside a VMWare machine using Mac OS X? – VAAA Sep 14 '15 at 21:34
  • @VAAA yes it's possible, But you will be able to develop just for Android on it, as it is a windows and developing for iOS is not possible on windows OS. – Morteza Soleimani Sep 14 '15 at 21:38
  • Oh, so impossible to run Xamarin IOS on windows? – VAAA Sep 14 '15 at 22:05
  • 1
    @VAAA on Mac you are able to develop for both Android and iOS , But on Windows just you can develop for Android, If you have Mac so without vm machine you can develop , But if you have windows , you should setup a vmware to load mac on it and develop for ios inside it. – Morteza Soleimani Sep 14 '15 at 22:08
  • 1
    @VAAA I do all of my development on Windows inside of Visual Studios, using a Mac running inside of Virtual Box as a Build Host. No need to do any development inside of Mac OS – SMKS Jan 20 '16 at 22:32
  • 1
    @SMKS could you please point me somewhere I could find more info on how to build such VM, either on VirtualBox or VMWare? Please take into account I have 0(zero) knowledge of the Apple ecosystem. – Luiso May 05 '16 at 16:02
  • 2
    @Luiso Of course, see my answer here which will give you a number of the links that you need to get started: http://stackoverflow.com/questions/27090796/can-apple-mac-os-runs-on-virtual-machine-in-windows-as-build-host-with-xamarin-i/32532323#32532323 – SMKS May 05 '16 at 16:27
  • @SMKS what kind of pc do you use to run mac on vm? cpu dual or quad core? intel or amd? how much ram? i tried this in my labtop but its slow and hangs. – Exlord Jun 09 '16 at 15:17
  • @SMKS intel core i7, 8 gigs ram, But the performance is not suitable for professional projects, I recommend to use a real Mac to do your work. – Morteza Soleimani Jun 10 '16 at 20:38
  • @MortezaSoleimani I used to use it to just deploy my apps. Now I have decided to partition my harddrive and install OSX on my other partition and I do it all from there. No need to buy a new laptop. – SMKS Jun 16 '16 at 01:03
21

Update 2018

Install VirtualBox https://www.virtualbox.org/

Install MacOs 10.13 on VirtualBox https://techsviewer.com/install-macos-high-sierra-virtualbox-windows/

Create or login with an apple account on the mac

Install XCode 9.0 https://download.developer.apple.com/Developer_Tools/Xcode_9/Xcode_9.xip

Enable Remote Login System Preferences > Sharing > Remote Login > Enable for All Users

Configure VirtualBox with an additional network adaptor (host-only)

In Windows > Visual Studio (Xamarin Project) > Pair with mac

Enter the IPaddress of the second network adaptor

Let Visual studio install Xamarin IOS, IOS SDK, additional tools on the Mac

All set up.

Verthosa
  • 1,671
  • 1
  • 15
  • 37
  • did you really try this and is it working? before waste our times :D – Emil Sep 21 '18 at 15:37
  • Yes it works. But it is not usable (even with a hello world sample). My machine specs i7-8550u 16GB (so it might better with a higher specs) – Ateik Dec 01 '18 at 11:24
  • 1
    @Ateik without you mean by that. you mean even with your pc configuration it is slow? – Emil Dec 16 '18 at 02:52
  • Yes, with the mentioned specs, its slow for compiling a hello world app, and running an iOS simulator – Ateik Dec 16 '18 at 05:20
  • 2
    Sorry to hear but I don't have performance problems in my setup. I assigned my virtualbox macos machine 4gig ram, 2processor. Host system: Core i7 2.4ghz 4cores, 32Gb of ram. It's perfectly usable here but of course this is some kind of hack/workaround. It will always be better to just purchase a mac – Verthosa Dec 17 '18 at 07:58
  • Could Docker be used instead of a virtual machine for better performance? – JCMiguel Apr 01 '19 at 20:15
  • @Verthosa can you update your instructions or to confirm us that those instructions works great still? – CDrosos Jun 15 '20 at 01:22
  • The moment I wrote it, it surely worked. I cannot confirm this nowadays because i don't have that VM up and running anymore - i now have a real macbook pro :-) – Verthosa Jun 15 '20 at 06:18
  • Yeah you just need 12 cores intel CPU and 32GB DDR5 RAM to export a damn IPA:) – pouya Dec 29 '20 at 23:46
8

An option is to use a remote service to do this. For example: http://www.macincloud.com

heronsanches
  • 524
  • 7
  • 12
  • 1
    This is a paid solution, tutorial link for using mac in cloud for Xamarin IOS build, https://www.c-sharpcorner.com/article/how-to-test-our-xamarin-ios-or-xamarin-forms-app-without-a-mac/ – Abubakar Riaz May 19 '19 at 01:59
  • Yes, this is paid, but the cheapest plan is for $30. It is much below even the cheapest refurbished Mac. As I understand I need Mac for few hours/month just to do a final build before publishing. Question: Do I need to have admin rights on Mac to do a build for iOS? I.e. do I need to buy a plan with full admin/root access? Assuming I have Visual Studio Enterprise 2019 and powerful Windows 10 desktop which MacInCloud plan is optimal for final build of Xamarin application for iOS? (Pay-as-you go, Managed Server, Dedicated Server, Azure Agent) – Alt-WN Mar 18 '20 at 09:47
1

Anybody know that a Virtual-Machine is the solution! but when you want to have an OSX on windows it's not really easy as you just talked about it. it's very important to find best OS ROM.

check it out here. and you have to know that limitation is Apple's doing, not Xamarin's.

Mehdi Saghari
  • 154
  • 1
  • 9
1

As someone that developed 3 Xamarin Forms apps, I would like to bring some points about the options:

Pair with a virtual Mac (VMWare, VirtualBox or cloud)

I worked this way for a while, but virtual machines consume a lot of hardware resources. Paid for a month to use a remote Mac, but the pairing and debugging process does not get much better.

Develop inside a virtual macOS

I have been using this option with good results. I just run everything on the macOS VMware virtual machine. Visual Studio and Emulator got a little slow (my CPU is i5 and 8GB ram), but is acceptable to make some adjusts. Advantages: Avoid pairing, Xcode to edit some resources, publishing.

Install macOS on Windows PC

This is kind of upgraded of previous suggestion. Didn't tested yet, but the performance should be better than VMWare if it works. They call this Hackintosh and is possible if your hardware is compatible.

Marcio J
  • 673
  • 7
  • 17