- Developing and debugging Flutter apps for iOS without a Mac
- Get a debug build of your app running on your iOS device
- Recommended: Building the app with Codemagic
- Codemagic — CI/CD for Flutter
- Boost your Flutter app development with continuous integration and delivery for Flutter projects. As the only CI/CD…
- Alternative: Building the app with Travis CI
- Travis CI — Test and Deploy Your Code with Confidence
- Edit description
- Installing and running the app
- Cydia Impactor
- Cydia Impactor is a GUI for working with mobile devices. You can use this tool to install IPA files on iOS.
- Preparing your machine
- Install dependencies
- Modify Flutter
- Preparing your project(s)
- Running and debugging
- Using an IDE (VS Code):
- Как мы iOS приложение тестировали из-под Ubuntu
- Apple Remote Desktop
- Действия со стороны Mac
- Действия со стороны Ubuntu
- Настраиваем Xcode
- Работа полученной системы
- Appendix
- Заключение
- How To Make iOS Apps on Linux
Developing and debugging Flutter apps for iOS without a Mac
Update: Flutter 1.17.0 now uses XCode instead of libimobiledevice to list devices. At the moment, you can downgrade to Flutter 1.12.13+hotfix.9 , or use the new Codemagic feature that allows you to remote control a Mac VM, and run a virtual device there (https://blog.codemagic.io/remote-access-to-virtual-mac-build-machine/)
It is possible to hot reload and hot restart your Flutter app on your iOS devices without having to use a Mac just like you can with Android devices! Here’s how:
Get a debug build of your app running on your iOS device
You could do that with a Mac (or Hackintosh, or VM), but since we don’t have access to a macOS machine we can use one remotely via Codemagic or Travis CI — completely free! ( as long as your project is on a GitHub, Bitbucket or GitLab repository).
Recommended: Building the app with Codemagic
Codemagic is recommended as it requires less setup and builds pretty fast
First, create an account or sign in to codemagic.io.
Codemagic — CI/CD for Flutter
Boost your Flutter app development with continuous integration and delivery for Flutter projects. As the only CI/CD…
Then, click the settings (gear) icon next to your app. Scroll down and click on “Build”. Make sure Mode is set to Debug, and select iOS under Build for platforms.
By default, Codemagic will test your app. Disable this feature unless you want to use it. (Thanks to Near Cz for the feedback!)
After that, build the app ( Start your first build).
New: now Codemagic lets you remote control the macOS virtual machine it uses to build your app. From there, you can run a simulator, test your app, and configure it from XCode. See https://blog.codemagic.io/remote-access-to-virtual-mac-build-machine/
Codemagic will send you an .app file via email.
Rename it so that it ends with .zip .
Extract it, and you’ll get a folder called Runner.app .
Create a folder called Payload and place Runner.app there.
Finally, compress the folder called Payload — this will be your IPA file (you may rename it to .ipa ).
Alternative: Building the app with Travis CI
Note: the free version of Travis CI only supports public GitHub repositories.
You’ll need to create an account on Travis CI and let it access your GitHub account.
Travis CI — Test and Deploy Your Code with Confidence
Edit description
Then, create .travis.yml on the root of your project with the following contents:
You’ll need to have the Travis command-line tools installed: (if the command below isn’t found, install RubyGems from https://rubygems.org/)
Then, setup deploying to GitHub releases:
When prompted for a file to upload, type build/ios/iphoneos/app.ipa .
Make sure your .travis.yml ends like this:
Now, push the changes to your GitHub repo:
Now, your app will be built and it will be added to your GitHub releases. Wait a bit for Travis to notice that you’ve added .travis.yml ; when it starts you can track the progress of your build. When it’s done, download your app.ipa from your project’s GitHub releases.
Note: If you don’t want to publish your .ipa file you can add draft: true to deploy: , and it will be published as a draft on GitHub instead.
Installing and running the app
To install the IPA file, you need to download Cydia Impactor from the link below.
If you are running Windows, you need to install iTunes first. (Make sure to install the non-Microsoft store version: under “ Looking for other versions?” select Windows, then scroll up and download).
Edit: a previous version of this article suggested installing the drivers bypassing iTunes installation. Apparently, that doesn’t work. (thanks to Andreas Opferkuch for pointing it out)
Cydia Impactor
Cydia Impactor is a GUI for working with mobile devices. You can use this tool to install IPA files on iOS.
Update: Cydia Impactor seems to be broken at the moment. If you have a developer account, you may follow Weisser Zwerg’s tutorial (thanks for sharing!) to sign and install the app. If you have a jailbroken device, you may use AppSync unified and ideviceinstaller. There are alternative tools to Cydia Impactor, but I can’t guarantee they’re malware-free, so use them at your own risk.
- Plug in your iOS device to your computer
- Run the Impactor executable
- Click “ Xcode”, then “ Revoke Certificates”
- Now, drag app.ipa (or the ZIP file you created) to the Cydia Impactor window (or use Device > Install Package…)
- You will be prompted to enter your Apple ID email and password. If it’s protected with two-factor authentication or you get an error message, you will need to create an app-specific password and use it instead of your password. See https://support.apple.com/en-us/HT204397. (thanks to Near Cz for pointing it out!)
- On your iOS device, go to Settings > General > Device Management (or Profiles & Device Management), tap your Apple ID email you just used to sign in, then Trust.
- Hooray! Our app is now installed.
Preparing your machine
Install dependencies
Make sure libimobiledevice and ideviceinstaller are installed (the latter isn’t used but Flutter will complain if it isn’t present):
The previous link didn’t have binaries anymore, thanks to Andreas Opferkuch for sharing an alternative one!
Download imobiledevice binaries from here. You also need a “ which ” binary, which you can download here. Add these binaries to flutter\bin (or any other location, but make sure it’s in your PATH ).
You might also need to install these packages (thanks João Matheus):
Modify Flutter
When detecting devices, Flutter checks whether you’re running macOS before searching for iOS devices. It also checks for XCode. Let’s remove those checks.
Note: it’s not working with the current stable (1.17.0) version. In the meantime, you can use Flutter 1.12.13+hotfix.9 instead.
Apparently, now Flutter uses XCode utilities instead of libimobiledevice, so the patch will not be as straight-forward. In the meantime, use an older version, or help contribute with the patch or another solution (fork, or a way of undoing the specific commits with the changes). I’ll update the article once this gets solved.
Download this file to your flutter folder (Click on “View raw” and press Ctrl+S). Then apply it: (this was tested with the stable branch on late April to early May)
Then rebuild the Flutter tool:
Preparing your project(s)
Make sure there’s a folder inside your project called build . If it’s not present, create it!
Running and debugging
Here comes the good part!
Using an IDE (VS Code):
- Open the command palette (Ctrl+Shift+P), and select “Debug: Attach to Flutter process”.
- Open the app, and wait for Flutter to sync files.
- You can now hot reload and hot restart as usual!
Tip: If hot reload doesn’t work, hot restart first!
Источник
Как мы iOS приложение тестировали из-под Ubuntu
В компании где я работаю наступила пора корпоративов тестирования нашего iOS приложения, и т.к. мако тут только у меня, а все остальные разработчики и, что самое главное, QA работают под Ubuntu, а значит айфонов у них нет , то пришлось придумать решение проблемы и избавить себя от мук передачи личного айфона в руки тестеров.
Если Вы сталкивались с подобной проблемой или просто интересуетесь темой шаринга одного мака с возможностью одновременной работы на нём, то прошу под кат.
Apple Remote Desktop
Сначала мы попробовали www.pieceable.com, вещь действительно хорошая, особенно с перспективами развития проекта, т.к. судя по главной его купили Facebook, но пока что скорость его работы оставляет желать лучшего, хотя самая идея (если кто не знаком с ней, то это запуск эмулятора на маке с последующей трансляцией картинки на клиенты) нам приглянулась.
Начиная с Mac OS X 10.6 Apple Remote Desktop (VNC, по сути дела, только тссс. ) поддерживает Multi-user Screen Sharing, и это как раз то, что нам надо, ведь основная задача была не отвлекать от рабочего процесса iOS разработчика, который работает за этим Mac-ом.
Действия со стороны Mac
Настройки для Mac OS X 10.8 aka Mountain Lion (для остальных систем не должны сильно отличаться):
- Создаём юзера, например, SimulatorViewer;
- Идём в Settings -> Sharing -> Remote Managment, там настраиваем Allow access for: SimulatorViewer, там выбираем как минимум Observe + Control + Open And Quit Applications;
- Жмём на Computer Settings и выбираем там VNC viewers may control screen with password, а так же вводим пароль для VNC.
На этом настройка Mac OS X части закончена.
Действия со стороны Ubuntu
Для подключения к Mac-у будем использовать Remmina Remote Desktop Client, который уже присутствует в стандартной поставки Ubuntu, как мне сказали:) Прошу прощения за «чужой» скриншот, нет сейчас возможности сделать свой:
- Connection->New.
- Protocol: VNC — Virtual Network Computing;
- Server — IP адрес Mac-а (показывается на нём в окне Sharing да и вообще много где, взрослые уже)
- Вписываем в User и Password наши данные для юзера SimulatorViewer, которого мы создали чуть выше;
- Color Depth выставляем в High color (15 bit), можно и больше, если сеть позволяет), от тормозов значение особо не избавит:)
Можете попробовать уже присоединиться, должен отобразиться экран Mac OS X, при этом сессия её пользователя за компьютером не прервётся.
Настраиваем Xcode
Осталось лишь сделать так, чтобы simulator билды Xcode-а были доступны для нашего юзера. Я выбрал самый простой вариант, переместив build-директорию в /Users/Shared/:
- Выгоняем iOS-разработчика от Mac-а покурить на 5 минут, а сами в это время лезем в настройки Xcode, секция Locations;
- Выбираем Derived Data: Custom, путь /Users/Shared/Xcode/DerivedData;
- В Advanced. жмём на Shared Folder и вводим Build;
- Комментируем рандомную строчку в коде программиста;
- создаём исполняемый(!) файл /Users/Shared/run.sh с таким содержимым:
- Заметаем следы и уходим от компьютера iOS-программиста.
Внимательный читатель заметит иденификатор blah, краткое объяснение: без него работать не будет мы специально задаём несуществующий путь и тогда симулятор попросит нас его указать при старте:)
Работа полученной системы
Как подсоединиться к рабочему маку мы уже разобрались, осталось запустить в нём симулятор и начать издеваться над программистом.
- Просим iOS разработчика собрать билд для симулятора(!);
- Заходим через VNC на наш мак (дальнейшие действия я описываю уже внутри машины, на которую зашли);
- Переходим в Finder-е в /Users/Shared/;
- Запускаем run.sh, который откроет симулятор с окном выбора файла;
- Если у нас приложение называется Habrahabr, то путь к нему будет такой:
Если всё сделали правильно, то приложение запустится и можно начинать тестировать.
Appendix
Q: У разработчика iMac 27» и айфон головного мозга, нельзя ли сделать разрешение поменьше?
A: При работе через VNC Вы можеет спокойно менять разрешение экрана, а так же их конфигурацию. Настройки экрана -> Scaled, 1024×768
Q: На маке 2 монитора, как отобразить только один из них?
A: Просто зайдите в настройки экрана и нажмите Mirror Displays, тогда будет показан только один экран.
Q: При работе ощущаются тормоза, что делать?(
A: Мы перепробовали несколько VNC клиентов и их настроек, но везде присутсвует проблема лагов и медленного «умерания» коннекта, с чем это связано так и не нашли, потому что в целом тестеров устроило. Помогает переподключение.
Q: А что делать пользователям Windows?
A: Тут такое дело (с), что мы не нашли Win компьютера в офисе, но всё сводится к простейшему поиску VNC клиента под Win, который умеет коннектится к Apple Remote Desktop.
Заключение
По сути дела статья — собирательный образ Mac VNC + VNC Client + Xcode custom build path + Running Simulator with target application и была написана с целью избавить Вас от гугления данных тем.
Приветствуются советы по улучшению схемы, особенно узкого места в виде VNC и его медленной работы.
Спасибо за внимание!
Источник
How To Make iOS Apps on Linux
So you love using a Linux machine but you want to develop iOS apps. It’s not super straight-forward since Xcode only runs on MacOS computers. I dug into this topic and will share with you how to do it yourself.
How To Make iOS Apps on Linux?
- Use a Virtual Machine to run a MacOS Environment
- Rent a Mac Online
- Dual Boot MacOS – Hackintosh Style
- Get started with an online Swift Sandbox
- Use third-party cross-platform solutions
- Buy a used or cheap MacOS computer
- In this article, I’ll break down these 6 options so you can decide what’s best for you.
Use a Virtual Machine to run a MacOS Environment
Virtual machines are created using software, this enables you to run a MacOS inside your Linux OS. There are a couple of different vendors that you can choose from:
- VirtualBox
- VMware WorkStation
I’d recommend VirtualBox, it’s used in many large tech companies and I’ve personally used it both for my own projects and professionally on the job. The installation process is super simple and getting it running MacOS is a breeze.
You’ll need to either find a MacOS image by searching for one online or by borrowing a friends laptop. Once you have that, you’ll be able to set up your virtual machine – adjusting settings such as hard drive space and memory to your liking.
Once you are inside your virtual machine, it should work almost exactly as if you owned a Mac. You’ll be able to install and run Xcode. Installing iPhone and iPad simulators will work as well. Sometimes the virtual ports may require minimal configuration in order for you to test on a real iOS device, however I have tried it and it works.
This is option is a great solution if you don’t mind a little bit of up front work to set it up. When it’s all been setup, its simple to turn on and off your MacOS when you need it for development!
Rent a Mac Online
Renting a Mac online is a hassle-free solution. Companies run a bunch of Macs in the cloud and charge users for access to them. Plans are usually very affordable and can range as low as $20/month.
This is a great way to see if you’re truly interested in iOS development before jumping in. Most of these companies have no contracts and you can cancel at anytime. Here are some companies that offer this product:
- MacInCloud.com
- MacStadium.com
- VirtualMacOSX.com
- XCodeClub.com
- MacMiniVault.com
- Xcloud.me
One of the downsides of renting a Mac in the cloud is that you won’t be able to test on a physical iOS device. You’ll have to rely on using the simulator. However, when you’re ready to test out your application before releasing to the app store, you can always install Apple’s TestFlight software to see how your app looks on a real device.
A huge benefit of a cloud development environment is being able to access it from anywhere in the world. You can access it from a carribean island or anywhere else you have an internet connection. All your settings will be saved in the cloud.
Dual Boot MacOS, Hackintosh Style
You could also install MacOS on your Linux machine. This is called dual booting, where your machine has two operating systems that it can start up from. This requires some technical work and not all computer hardware will be compatible will MacOS.
Here are some sites to get you started on created a dual boot – also known as a Hackintosh machine:
- tonymacx86.com
- hackintosh.com
- reddit.com/r/hackintosh/
- osx86project.org
Honestly, it’s quite a bit of effort to setup a hackintosh and its hard to keep it up to date. Hardware incompatibility is troublesome to debug and can take a lot of time.
If you’re looking just to build iOS apps, I recommend a different method. If you’re super interested in building custom computers though, this may be a good option for you!
These sandboxes allow you to get started immediately, no Xcode or any other installation of software is required.
You won’t be able to build a full iOS app from these online sandboxes, but you will be able to jumpstart your learning. This is a good option if you’re looking to get your feet wet in Swift code.
It’s also the easiest option and requires the least amount of work! Just click one of the links below and you can begin writing and compiling Swift code immediately.
Use third-party cross-platform solutions
Third party cross platform solutions have grown a lot recently. Larger companies have started to develop open source libraries to allow developers to code iOS and Android apps in different languages. Here are some of your options:
- PhoneGap
- Cordova
- Ionic
- Appcelerator
- React Native
- Flutter
- Xamarin
The hottest ones on the market right now are React Native and Flutter. React native is maintained by Facebook and Flutter is maintained by Google.
These libraries offer many benefits including coding in your favorite language and being able to learn both iOS and Android development at the same time.
However there are some draw backs. For most of these libraries, you still won’t be able to install on iOS device or simulator without a Mac machine. You can still develop the app and then later test it using Apple’s TestFlight. During development though you may just have to stick to the Android simulator. This will be similar, but the exact same as an iOS simulator.
These frameworks will also always be behind the native development path of using Xcode. This is because when Apple releases new features for iOS, they won’t make it onto this framework until weeks or even months later. It’s not an issue for most developers, but if you want to use the latest and greatest features when Apple releases them every year, you may want to look at a different solution.
Buy a used or cheap MacOS computer
This is the simplest solution. Buying a cheap MacOS computer will simplify your development greatly. This will eliminate an entire group of bugs from your development environment.
You can develop using almost any MacOS machine. Mac minis, which are Apple’s cheapest MacOS product, will work just fine. Even a Mac mini from a couple years back will work great.
Apple offers refurbished units on their website and you can also check eBay and other sites for deals too.
This will be a good investment if you’re looking to take iOS development as your career or as a serious hobby.
If I have about
$200-300, I would just buy a refurbished or used Mac mini. This is simplest and will save me a lot of time.
If I am not sure about this whole iOS programming thing, I would rent a Mac from the cloud for a month to test it out. That way I can just cancel later on and just be out $20.
If I have no money at all, I would look into setting up a virtual machine on my Linux computer.
If I have no money at all and no computer, I would try it out in the Apple store. Apple employees don’t care how long you spend in the store, that’s the policy! Where theres a will theres a way 🙂 I’ve heard of people building entire apps from the iMacs at the Apple store.
Источник