Installing Xamarin.iOS on Windows
This article describes how to set up a Windows machine and a Mac build host for Xamarin.iOS development.
Overview
To build Xamarin.iOS apps with Visual Studio 2019 on Windows, you will need:
A Windows machine with Visual Studio 2019 installed. This can be a physical or a virtual machine.
A network-accessible Mac set up with Apple’s build tools and Xamarin.iOS. Visual Studio 2019 accesses this machine over a network connection to use Apple’s build tools, which are required for compiling native iOS applications.
Don’t have access to a Mac?
If you do not have access to a Mac, you can use MacinCloud or MacStadium; both services provide cloud-based Mac hardware that you can use to build Xamarin.iOS projects.
Setup
To get set up for Xamarin.iOS development in Visual Studio 2019, follow these steps:
Set up Windows (Install Visual Studio 2019)
Xamarin.iOS works with Visual Studio 2019 Community, Professional, and Enterprise editions, on a standalone or virtual machine.
Set up Mac (Install Xcode and Visual Studio for Mac)
To build, debug, and sign iOS applications for distribution, Visual Studio 2017 must have network access to a Mac build host configured with both Apple’s developer tools (Xcode) and Xamarin.iOS.
If you would prefer not to install Visual Studio for Mac, Visual Studio 2019 can automatically configure, the Mac build host with the software necessary to build Xamarin.iOS applications. For more information, see Automatic Mac provisioning.
Pair to Mac (Connect Visual Studio 2019 to the Mac)
For Visual Studio 2019 to use the iOS build tools on the Mac, the two machines must connect over a network.
Overview
To build Xamarin.iOS apps with Visual Studio 2017 on Windows, you will need:
A Windows machine with Visual Studio 2017 installed. This can be a physical or a virtual machine.
A network-accessible Mac set up with Apple’s build tools and Xamarin.iOS. Visual Studio 2017 accesses this machine over a network connection to use Apple’s build tools, which are required for compiling native iOS applications.
Setup
To get set up for Xamarin.iOS development in Visual Studio 2017, follow these steps:
Set up Windows (Install Visual Studio 2017)
Xamarin.iOS works with Visual Studio 2017 Community, Professional, and Enterprise editions, on a standalone or virtual machine.
Set up Mac (Install Xcode and Visual Studio for Mac)
To build, debug, and sign iOS applications for distribution, Visual Studio 2017 must have network access to a Mac build host configured with both Apple’s developer tools (Xcode) and Xamarin.iOS.
If you would prefer not to install Visual Studio for Mac, starting with Visual Studio 2017 version 15.6, Visual Studio 2017 can automatically configure the Mac build host with the software necessary to build Xamarin.iOS applications. For more information, see Automatic Mac provisioning.
Pair to Mac (Connect Visual Studio 2017 to the Mac)
For Visual Studio 2017 to use the iOS build tools on the Mac, the two machines must connect over a network.
Удаленный симулятор iOS для Windows Remoted iOS Simulator for Windows
Удаленный симулятор iOS для Windows позволяет тестировать приложения в симуляторе iOS, который отображается в Windows с Visual Studio 2019 и Visual Studio 2017. The Remoted iOS Simulator for Windows allows you to test your apps on an iOS simulator displayed in Windows alongside Visual Studio 2019 and Visual Studio 2017.
Начало работы Getting started
Удаленный симулятор iOS для Windows автоматически устанавливается в Visual Studio 2019 и Visual Studio 2017 как часть Xamarin. The Remoted iOS Simulator for Windows is installed automatically as part of Xamarin in Visual Studio 2019 and Visual Studio 2017. Чтобы использовать ее, выполните следующие действия. To use it, follow these steps:
- Свяжите Visual Studio 2019 с узлом сборки Mac. Pair Visual Studio 2019 to a Mac Build host.
- Начните отладку проекта iOS или tvOS в Visual Studio. In Visual Studio, start debugging an iOS or tvOS project. Удаленный симулятор iOS для Windows появится на компьютере Windows. The Remoted iOS Simulator for Windows will appear on your Windows machine.
Просмотрите это видео, чтобы получить пошаговые инструкции. Watch this video for a step-by-step guide.
Окно симулятора Simulator window
Панель инструментов в верхней части окна симулятора содержит несколько полезных кнопок. The toolbar at the top of the simulator’s window contains a number of useful buttons:
Главная — имитирует кнопку «Главная» на устройстве iOS. Home – Simulates the home button on an iOS device.
Блокировка — блокирует симулятор (проведите пальцем, чтобы разблокировать). Lock – Locks the simulator (swipe to unlock).
Снимок экрана — сохраняет снимок экрана симулятора (хранится в Изображения\Xamarin\Симулятор iOS\ ). Screenshot – Saves a screenshot of the simulator (stored in Pictures\Xamarin\iOS Simulator\).
Параметры — отображает клавиатуру, расположение и другие параметры. Settings – Displays keyboard, location, and other settings.
Другие параметры — предоставляет различные параметры симулятора, такие как вращение, жесты встряхивания и Touch ID. Other options – Brings up various simulator options such as rotation, shake gestures, and Touch ID.
Параметры Settings
Щелкнув значок шестеренки на панели инструментов, вы откроете окно Параметры: Clicking the toolbar’s gear icon opens the Settings window:
Эти параметры позволяют включить аппаратную клавиатуру, выбрать расположение, о котором устройство должно сообщить (поддерживаются как статические, так и подвижные расположения), включить функцию Touch ID, а также сбросить содержимое и настройки симулятора. These settings allow you to enable the hardware keyboard, choose a location that the device should report (static and moving locations are both supported), enable Touch ID, and reset the content and settings for the simulator.
Другие параметры Other options
Кнопка с многоточием на панели инструментов открывает другие параметры, такие как вращение, жесты встряхивания и перезагрузка. The toolbar’s ellipsis button reveals other options such as rotation, shake gestures, and rebooting. Эти же параметры можно просмотреть в виде списка, щелкнув правой кнопкой мыши в любом месте окна симулятора: These same options can be viewed as a list by right-clicking anywhere in the simulator’s window:
Поддержка сенсорного экрана Touchscreen support
Большинство современных компьютеров Windows имеют сенсорные экраны. Most modern Windows computers have touch screens. Поскольку удаленный симулятор iOS для Windows поддерживает взаимодействия с сенсорным экраном, вы можете протестировать приложение с помощью жестов сжатия, прокрутки и сенсорного ввода с несколькими пальцами, которые используются в физических устройствах iOS. Since the Remoted iOS Simulator for Windows supports touch interactions, you can test your app with the same pinch, swipe, and multi-finger touch gestures that you use with physical iOS devices.
Аналогичным образом удаленный симулятор iOS для Windows обрабатывает входные данные пера Windows в качестве входных данных Apple Pencil. Similarly, the Remoted iOS Simulator for Windows treats Windows Stylus input as Apple Pencil input.
Обработка звука Sound handling
Звуки, воспроизводимые симулятором, поступают из динамиков узла Mac. Sounds played by the simulator will come from the host Mac’s speakers. Звуки iOS не слышны на компьютере Windows. iOS sounds are not heard on the Windows computer.
Отключение удаленного симулятора iOS для Windows Disabling the Remoted iOS Simulator for Windows
Чтобы отключить удаленный симулятор iOS для Windows, перейдите к Средства > Параметры > Параметры Xamarin > iOS и снимите флажок с пункта Удаленный Симулятор для Windows. To disable the Remoted iOS Simulator for Windows, navigate to Tools > Options > Xamarin > iOS Settings and uncheck Remote Simulator to Windows.
Если этот параметр отключен, при отладке на подключенном узле сборки Mac открывается симулятор iOS. With this option disabled, debugging opens the iOS Simulator on the connected Mac build host.
Устранение неполадок Troubleshooting
При возникновении проблем с удаленным симулятором iOS журналы можно просмотреть в следующих расположениях: If you experience issues with the Remoted iOS Simulator, you can view the logs in these locations:
/Library/Logs/Xamarin/Simulator.Server Mac –
/Library/Logs/Xamarin/Simulator.Server
Если вы сообщаете проблеме в Visual Studio, прикрепление этих журналов может быть полезным (есть параметры для сохранения конфиденциальности загрузок). If you report a problem in Visual Studio, attaching these logs might be helpful (there are options to keep uploads private).
Начало работы с Xamarin.iOS
Xamarin.iOS позволяет разработчикам создавать собственные приложения iOS с помощью тех же элементов управления пользовательского интерфейса, которые доступны в Objective-C и Xcode, только теперь с гибкостью и элегантностью, присущими современному языку (C#), эффективностью библиотеки базовых классов .NET (BCL) и двух первоклассных интегрированных сред разработки — Visual Studio для Mac и Visual Studio. В этих материалах представлен процесс настройки и установки Xamarin.iOS и рассматриваются основные принципы разработки Xamarin.iOS.
Требуемые компоненты
Для выполнения сборки для Xamarin.iOS необходимы следующие компоненты:
- последняя версия Visual Studio;
- актуальный пакет SDK iOS;
- актуальная версия Xcode;
- минимальная версия macOS, необходимая для Xcode.
Актуальная версия Xcode доступна для скачивания в центре разработчиков iOS (требуются данные для входа) или в магазине Mac App Store:
Материалы по началу работы
Настройка и установка
Приступите к использованию Xamarin.iOS в Visual Studio для Mac или Visual Studio. В этом разделе рассматриваются скачивание, установка с помощью установщика Xamarin, вход с учетной записью Майкрософт, общие моменты по устранению неполадок, подготовка устройств и многое другое.
Привет, iOS
Из этого состоящего из двух частей руководства вы узнаете, как создать свое первое приложение Xamarin.iOS в Visual Studio для Mac или Visual Studio. Вы также получите представление об основах разработки приложений iOS с помощью Xamarin. В этом руководстве рассматриваются средства, понятия и действия, необходимые для создания и развертывания приложения Xamarin.iOS.
Привет, iOS (несколько экранов)
В этом руководстве из двух частей мы расширим функционал приложения, созданного в руководстве по началу работы с iOS, для работы со вторым экраном. В нем рассматриваются такие концепции, как конструктивный шаблон модель-представление-контроллер, реализация навигации iOS и углубленные сведения о структуре и работе приложения iOS.
Xamarin для разработчиков Objective-C
В этой статье описано, как разработчикам Objective-C перейти на платформу Xamarin.
Видео
Создание приложения iOS с помощью Xamarin для Visual Studio