Developing iOS Apps in Visual Studio with MacinCloud

December 5, 2015 at 5:26 pm 8 comments

Cross-Platform Mobile Development with Xamarin

Suppose you’re a .Net XamarinLogo developer and you recently discovered Xamarin’s cross-platform framework for doing mobile app development using the .Net languages and libraries. You’ve used Visual Studio to make a killer Android app.
Now you want to make an iOS version of the app, but you don’t have a Mac– and Apple’s licensing requirements specify that you must use a iosLogoMac to build iOS apps. Apple is fine with you doing all the development (writing the code and creating the UIs) anywhere you like, but the code has to be compiled and linked on a Mac. Xamarin takes care of the first part of this. Using Xamarin’s tools, you can develop iOS apps right in Visual Studio. There’s even
an VisualStudioLogoiOS UI designer that integrates into VS. But, Visual Studio still needs to connect to a Mac to build your project. The Mac can be on your local network or on the internet. To test the app, you can use a physical device (iPad, iPhone, or iPod), or you can run a simulator on the remote Mac.

MacinCloudLogo2So, that’s all great, but you still need a Mac and maybe you’re not ready to go out and buy one. There’s a solution!  You can rent time on a Mac in the cloud. I’ve been testing the MacinCloud service. I’m using with Visual Studio and the Xamarin tools to do iOS development and it actually works!

Setting up Visual Studio with MacinCloud

The first thing to do is sign up for a plan on MacinCloud. Since I’m a faculty member, I qualify for one of the academic plans (available to students too). I’m paying $16 a month for 3 hours of time a day. There are a few things you’ll need to do so that your Mac-in-the-cloud will work for Xamarin iOS development:

  • When you fill out the online subscription form, be sure to select either Yosemite or El Capitan as the operating system. Don’t select Mavericks, Xamarin’s new Mac Agent for connecting Visual Studio to the build server on the Mac requires OS X Yosemite or newer.
  • After you’ve subscribed, open a support ticket and ask for a “Xamarin remote build port add-on”.  They’re currently charging $2.50 a month for the add-on. MacinCloud was quick to respond to my request (less 24 hours).

I’m assuming you’ve already installed Visual Studio and the Xamarin development platform on your Windows development machine. You don’t need to install anything on the MacinCloud machine, it comes with Xcode and the Xamarin software already installed.   Once that’s done, you’re ready to go.

Before setting up a connection to your MacinCloud machine, you need to create an iOS project in Visual Studio. If you don’t want to create a real project yet, that’s OK. You can just use one of the Visual Studio project templates to create a project with nothing in it.

To set up a connection to your MacinCloud machine, you’ll use the Xamarin Mac Agent which can be launched from the Visual Studio Tools, iOS menu.


When the Mac Agent is first launched, it will display instructions for setting up your Mac. You don’t need to do this, so just click the “OK” button. Now the Mac Agent dialog will be displayed. Clic, on the “Add Mac…” button and enter the IP address for your MacinCloud account. (MacinCloud will have sent this to you with your login credentials.)MacAgentIpDialog

After you click “Add”, you will see a dialog where you can enter the login credentials for your MacinCloud account.MacAgentLogin.PNG

Click the “Login” button and you’re done!

Building an iOS Project from Visual Studio

Once you’ve set up the Xamarin Mac Agent you can build your iOS project just like you would any other project in Visual Studio. But, Visual Studio will use the XCode build server on your MacinCloud machine to do the build. The output from a successful build will look like this:

1>------ Rebuild All started: Project: Xamarin_iOS_BlankApp, Configuration: Debug iPhoneSimulator ------
1>  Generated session id: c934f3fbd1969327783321214bc00390
1>  Generated build app name: Xamarin_iOS_BlankApp
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Windows.After.targets(54,5): warning VSXRunBuildLocally: The project Xamarin_iOS_BlankApp was built while disconnected from a Mac agent, so only the main assembly was compiled. Connect to a Xamarin Mac build agent to build the full application.
1>  Xamarin_iOS_BlankApp -> C:\Users\brian\Documents\Visual Studio 2015\Projects\Xamarin_iOS_BlankApp\Xamarin_iOS_BlankApp\bin\iPhoneSimulator\Debug\Xamarin_iOS_BlankApp.exe
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

Running your iOS Project

To run your project in the Xcode iOS simulator on your MacinCloud machine, you will first need to connect to your MacinCloud account using a Remote Desktop app. MacinCloud will have sent you instructions and a set of files for launching Remote Desktop. Once you’ve logged into MacinCloud using Remote Desktop you will see the desktop of the remote Mac displayed. You don’t need to do any thing on the Mac.

In Visual Studio follow these steps:

  1. Connect the Xamarin Mac Agent to your MacinCloud account.XmaButton
  2. Select “iPhoneSimualtor” as the Solution Platform.SimulatorChoices.PNG
  3. Now you can the project and your app will show up in the iOS simulator in Remote Desktop.iosSimulatorOnMacinCloud.PNG

That’s it. You’ve now successfully created, built and tested an app using Visual Studio!

Addendum: Deploying an App to a Physical Device

In order to deploy your app directly to an iPhone or iPad, the device would need to be connected to the Mac you used to build the project. This isn’t possible with MacinCloud, but there are still ways to deploy your app. testflight-96x96_2xThe method recommended by MacinCloud is to deploy your app via Apple’s Test Flight service. To do this you upload your app from the remote Mac (on MacinCloud) to Test Flight. Then download the app from Test Fight to your device. Read more here: Test Apps on Physical iOS Devices.


Entry filed under: C#, iOS, Programming, Xamarin. Tags: , , , .

Learn to Write iOS Apps! Testing iOS Apps on Hardware Devices

8 Comments Add your own

  • 1. Introductory iOS App Development course | Bird's Bits  |  December 9, 2015 at 8:49 pm

    […] to register for the class. You can do your lab work on either a Mac or Windows PC. If you are developing your iOS apps on Windows you will still need to have access to a Mac over a network, but you don’t have to own a Mac, […]

  • 2. rav  |  December 17, 2015 at 3:51 am

    How fast was it? is it productive to use cloud service? Can you do fast development connecting to this?

    • 3. Bahrom  |  December 17, 2015 at 5:20 am

      The builds are quite fast on MacinCloud, but the simulator is a bit slow. The main factor affecting the apparent speed of the simulator will be your internet speed since you will be viewing the simulator via a remote desktop connection.

      Could you be productive? If you have a fast internet connection, I would say yes, but only if you are developing apps with relatively simple UIs. If the UI requires intensive testing you will spend a lot of time waiting for the simulator screen to refresh.

  • 4. Brandon Tran  |  July 6, 2016 at 7:06 pm

    Thanks for the article. Macincloud (and probably Microsoft) should seriously pay you for writing this.

    • 5. Bahrom  |  July 6, 2016 at 8:27 pm

      I think your right. This post has had thousands of views!

  • […] Developing iOS Apps in Visual Studio with MacinCloud […]

  • 7. UseYourHead  |  October 5, 2016 at 6:01 am

    The only scenario I think Macincloud would be a better choice than spending the $500 for a Mac mini would be if you wanted to make a simple iOS app and that’s the only app you’ll ever create. Otherwise, you’d be much better off getting the mini and not limiting your options for developing and testing.

  • 8. Martin Warren  |  November 7, 2016 at 5:50 am

    @UseYourHead, no. You develop your app on a PC and test the app in the simulator on your PC. You only need MacInCloud to do the iOS build via Xcode, then test the app on your device. The internet speed is irrelevant. Forking out hundreds of dollars for a Mac Mini just to build your app is not cost effective because most apps don’t earn that much from the App Store.
    Yes buy a Mac Mini if you make that much money from your app or if you have money to burn.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed

Bird’s Bits

Computers, software & the Internet

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 41 other followers

%d bloggers like this: