Flutter: Building and distributing a .ipa File without Mac/Apple Developer Account? - ios

I'm new to Flutter and Travis CI, so im having minor problems setting up the following. From what i read, it should be possible, but im not sure how exactly.
My current setup uses my existing Travis CI account, to build all my changes using flutter build ios --no-codesign. This generally works and should output a Runner.app-File.
My aim now is, to transform this File into a usable .ipa, which i can distriute to my personal iPhone/iPad via www.diawi.com.
I know that it is generally possible, to make Travis CI to commit results back to github, and i also know, that it should be possible, to build/create an .ipa from the .app file using the CLI of XCode.
Can someone help/hint me with building a full build.sh, which performs the flutter build, the xcode build, the ipa-extraction and the push of the .ipa to git?

Related

Flutter build IOS on windows

I'm working on a flutter project and I want to build the IPA of my code using windows. I don't want to test the application in my windows I want just to build the IPA. Is it possible to do it. Any help is highly appreciated.
The only way to generate an IPA from you windows machine is by using a CI/CD service like Codemagic using the steps described in this article:
link your repository (Github, BitBucket , or Gitlab).
from settings > build for platforms > IOS
change the .app file you received to .zip and extract it.
You will find a file called Runner.app, put in a folder and compress it back.
change the extension from .zip to .ipa.
And here's your first IOS build without a Mac device.
You cannot build a flutter iOS app directly from Windows. What you can do is use external tools to do it. One of these tools is Appollo (https://github.com/Appollo-CLI/Appollo). It's a python CLI tool that let you access remote MacOS build machines.
Here is a demo of how to create the IPA on windows : https://www.youtube.com/watch?v=ZX3DAMwlEfM&t=11s
It's pretty easy to use :
First install it
pip install appollo
Then setup your Apple Developer account with Appollo : https://appollo.readthedocs.io/en/master/tutorial/2_configure_app_store_connect.html
Finally you can build the app and retrieve the IPA
appollo build start --build-type ad-hoc
appollo build ipa
And that's it.

What exactly does Flutter build iOS do? Is this really necessary?

I would like to fully understand this command and what happens behind the scenes. Here are a few pieces of information I've understood so far but somehow I cannot connect the dots:
When deploying an iOS we need to go through these steps:
build a flutter app in release mode, which will make an .app file/folder
archive & sign the .app file which will convert it into .ipa
send the signed .ipa to the appstore
flutter apps can have 3 modes: 1. debug 2. release 3. profile
running flutter build ios creates a build/ios folder, including the Release-iphoneos/Runner.app
Xcode creates its own .app in ~/Library/Developer/Xcode/DerivedData/Runner-...
Now, questions:
Is the build/ios/Release-iphoneos/Runner.app that Xcode converts into .ipa? I'm asking since I know that Xcode creates its own .app in ~/Library/Developer/Xcode/DerivedData, so I'm not sure if Xcode just copies build/ios/Release-iphoneos/Runner.app in here: ~/Library/Developer/Xcode/DerivedData/ or not
What happens if I don't run flutter build ios before? Will Xcode use only a debug mode of my app? If so, how come it removes the debug flag in the upper right corner?
When I clean my build folder in Xcode (shift+cmd+K) and then I archive the app and it will still build a new .app and then it converts it to .ipa. What mode was this .app created in? Was it a release app? If so, again, why is it necessary to run flutter build ios before and why not just archive it from the Xcode?
Thanks to everyone who tries to unleash this big mystery for me and for everyone else wondering.
The reason you should run a flutter build ios before archive is because archive uses the last build configuration from the results of running flutter build ios.

Redirect Flutter SDK path when building iOS build?

I wrote a Flutter app using IntelliJ on my Linux machine. I need to build the ipa file for iOS devices, and I do not have a Mac.
I plan on using a "Mac in the cloud" server to prepare the release build for the App Store. I have been mapping out all of the steps that I need to do to do the whole process, and I got to wondering: if I am opening my project folders on a server somewhere, do I have to configure the path to the Flutter SDK that I will have to download on to server machine?
I have looked at the Flutter.io documentation, but did not find an answer to this question.
Goal: to generate a release build for iOS on server machine from the project folders that I used on my Linux machine to make release build for Android.
Well, to answer my own question, IntelliJ seems to find the correct flutter path on its own somehow. It give me an error message after build command, but then continues using correct flutter path. I am pretty sure that I never told the program where to find flutter.

Jenkins - command line build iOS project

I have an iOS project cloned from repo into my jenkins account. Xcode is not yet installed. I know command line scripts to build an iOS project including targets/configurations/profiles etc. Certificate and provisioning profile is installed in jenkins account. I am wondering if there is a way to build and create ipa without installing Xcode in jankins account. Does apple provide any developer tools for building and creating IPA through command line only?
Advance thanks
Every building option for iOS apps requires Xcode, but apple does provide tools for building via CLI. A ton has changed in the most recent iOS OS upgrade and there are incredible tools out there for CI/CD app delivery. What you end up using should really depend on what you want to maintain over time and how advanced your system needs to be.
To get Builds working in Jenkins
Step 1 : Install Xcode on the Jenkins node that will be doing the builds. You wont be using the Xcode UI but you will need it installed, there is currently no way to build IPAs without Xcode.
Step 2: Choose your build tool
You could write your own build scipts and manage provisioning profiles on the machine. xcodebuild is the CLI tool you are looking for. If you end up going down this route make sure to use xcpretty or you will loose your mind with giant build logs.
Fastlane is an amazing toolset for building mobile apps, it might change your life. Check out these examples and how to get started.
Apple has an xcode build server that Jenkins could possibly talk to.
The first two in this list do a good job of managing provisioning profiles out of the box, and that can save you major headaches down the road if you need to scale

Is there a way to use Fastlane to deliver app to a physical device?

I use Fastlane to build and deliver my apps, but still could not find a way to build and deliver the apps directly to my physical device (attached to the Mac) via command line. Currently this is the only task I need to use Xcode to accomplish.
do you now about this tool? https://github.com/phonegap/ios-deploy I know that this tool isn't fastlane but you can combine with fastlane. Build *.app from fastlane and upload with ios-deploy. (ios-deploy command can be inside of fastlane because you can call any script from fastlane)
I hope that my answer make sense.

Resources