How to Build a flutter app for iOS.
This is a general discussion about how to build a flutter application for iOS, as we build and release apps in android, the process for it also remains the same but some points to remember.
For Building an app for iOS, we should require a macOS operating device like MacBook or Windows machine with Virtual box.
We should have a Xcode and VSCode in it and open the project in VSCode and install Flutter and Dart extensions.
Now, open the terminal and Go to ios folder in it, and install pods and cocoapods in it through terminal.
For pods Use:
pod install
pod install —repo—update
For cocoapods Use:
sudo gem install —cocoapods
It’s just like adding dependencies for our project.
After installing them, we should run “Flutter pub upgrade” once.
Now open XCode and navigate to your project folder and then in ios folder open “Runner.xcodeproj” , this is the main file for ios,
after opening it, in Navgation panel you can see Runner and Pods.
Now click on Runner , then it’ll open the project general and compatibility modes etc.
Now at right side in general tab select your TEAM to run the project or if you don’t have a team we should create one by creating an account in AppStore connect , to upload our app , or we can use one common TEAM which is already present, now connect your mobile to MacBook through cable (in newer version it’ll automatically connect through local network without cable.).
After selecting team , select in which devices you want to run the app like iPhone , iPad, MacBook. You can select as you want and now click on info tab it’ll open info.plist file (it is like manifest) now name your app and give package name at Bundle Name and Bundle ID and
you can add permissions of camera, notifications or other permissions in this file as Key and String or Key and Boolean or Dict and Array, now save them
and in Runner folder at there will be another folder called assets , in it you can add your icon images as required with a content.json file which has all these images initialisation. Note that there will be no transparency in these images.
Now at top you can see run , click on it and yes our flutter app is built for ios.
If you want to release app, first we should have a physical device and click on device and click Edit configurations and there you can see a dropdown debug , release, profile. Click on release and check debug executable.
If you want to upload app to Appstoreconnect, click on Build and click Archive, it’ll build a ipa file in it and you can export it as a normal ipa file or you can distribute it directly to AppStore from Xcode.