-
Notifications
You must be signed in to change notification settings - Fork 8
Pro Tips iOS
-
Version of Xamarin.iOS should match on both Windows and MacOS PC or Laptop, this will cause your build to fail even if your code is all good.
-
Make sure you enable remote logging for the MacOS user (
System Preferences
>Sharing
> Tick markRemote Login
and allow access to specific user(s). (This step on: MacOS PC or Laptop) -
Delete passphrase.key file from
C:\Users\{your-account-name}\AppData\Local\Xamarin\MonoTouch
to be able to connect to same MacOS PC or Laptop with either same or different credentials. (This step on: Windows PC or Laptop) -
Depending on version of Visual Studio, when you open/create a cross-platform solution (.Droid, iOS and PCL/Shared projects), next when you try to build your .iOS project, it would not build at all, even though you are connected to a remote Mac Agent and everything else seems to be just fine. In this case, look up in the menu bar next to Debug drop down and check if the drop down value next to Debug drop down is iPhone Simulator and not iPhone (iPhone as an option works for if you want to run the .iOS project on an actual iOS device, but most of the time, you need to select iPhone Simulator to be able to build your .iOS project)
Note: This was fixed in recent updates of Visual Studio, but chances are you may encounter this bug.
A fundamental requirement to be able to build and run iOS apps using Visual Studio on Windows is that you need a compatible MacOS PC or Laptop in the network (a physical PC or a laptop running MacOS)
The reason being, Apple has not yet provisioned a way to access it's native APIs and SDK (iOS SDK) by simply installing something on your Windows PC or Laptop.
So even if you are using Visual Studio on Windows PC or Laptop, you will need to setup a MacOS PC or Laptop and then make sure the MacOS PC or Laptop is online in the same network as your's.
- To be able to successfully connect, build and run iOS apps using Visual Studio on Windows PC or Laptop, you need to make sure, the version of Xamarin.iOS is same on both Windows PC or Laptop and MacOS PC or Laptop, if that does not match, your build will fail with an error even though your code is just right.
-
To be able to connect to a remote MacOS PC or Laptop, you need to enable remote logging from the MacOS PC or Laptop for that user.
-
Your credentials change and that may prevent you from logging in to remote MacOS PC or Laptop, in that case, open Visual Studio, select Help in top menu bar (last option in the right), select Xamarin, select Open Logs, this will open the folder where Xamarin logs are saved
C:\Users\{your-account-name}\AppData\Local\Xamarin\Logs\15.0
in Windows Explorer (15.0 in the path may be 14.0 or 12.0 depending upon version of Visual Studio you might be using).
Next, select Xamarin as an option in the address bar (Windows Explorer), this takes you to Xamarin folder which should contain Logs and other bunch of folders.
Here you should be able to find a folder named MonoTouch (this folder will be created only if you had connected to a remote Mac Agent, if you never connected to a Mac Agent using Visual Studio, this folder would not be created and hence you may not see it at all), double click to see contents of the folder, once in the folder, look up for a file named passphrase.key (this is the file which holds the credentials to your existing MacOS PC or Laptop connection), right click the file and delete it.
Now, come back to Visual Studio and try to connect to your MacOS PC or Laptop, the connection should be just fine (unless the credentials are in-correct).