iOS - AppDaddy-Software-Solutions-Inc/framework-markup-language GitHub Wiki
Process from scratch(mac only):
- Download and update Xcode
- Install cocoapods $
sudo gem install cocoapods
- Clone git to a lowercase letters, single word folder. eg
applecore
- Open Android Studio/VSCode and ensure system.dart is set to mobile
- If you have any changes commit them to a disposable branch
- Go to your folder
applecore
> ios > Open the *.xcworkspace with Xcode. egRunner.xcworkspace
with Xcode - In Xcode click the
Runner
xcodeproj
-
This opens our app settings, we will need to adjust some of these, some are optional like the internal Display Name.
-
In General under Identity set a unique bundle identifier, this tutorial uses co.appdaddy.core - it is important to use a different bundle identifier for each application but you will have to generate new files, more on that later.
-
In General under Deployment Info set the target iOS version, we will use 13.0 for all the ML libraries to work
-
Now click the Signing & Capabilities tab check Automatically let Xcode manage signing and select your Team
-
Finally click the Info tab set a Bundle name (this is the app name on iOS)
-
Click the Flutter folder in the above picture and open Release.xconfig, replace it with this
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"
#include "Generated.xcconfig"
- In Android Studio and run $
flutter pub get
flutter clean
flutter build ios
- Reopen Xcode from the .xcworkspace Click the ▶️ button to build and run, it may fail (that's ok), stop ⏹️ it if it fails to build.
- From the ios folder of the flutter project run $ (if pod install fails for SWIFT compatibility follow this)
pod install
or on M1 Chipsarch -x86_64 pod install
- To use firebase we have to add a specific .plist to our xcode project
- Download one of the below bundles if you don't have a valid one for the project and put the file in your ios/Runner directory
- Then drag it over our
Runner
application folder in Xcode to link it, (be sure to add to all targets) as in the image below
co.appdaddy.core bundle: Get co.appdaddy.core plist
for other bundles: Firebase iOS Setup Guide
- (*only for new Xcode installs - ignore any errors) From the ios folder of the flutter project run $
pod deintegrate
pod install
- In Xcode make sure the Runner has a usb connected device (iPhone as shown in above image)
- Click the ▶️ button to build and run, if you get a Build Successful message continue to next step
- A permissions error will pop up on the phone and prevent your app from running the build, go to Settings > General > Device Management > Apple Development - click Trust App
- In Xcode click the ⏹️ to end the process and the ▶️ to rebuild and run the application
The app should now be installed in your device, automatically open and rebuilding should be straightforward.
Uploading to App Store
- cd proj folder,
flutter build ios
* if it successfully builds you can go in Xcode to Product>Archive and that will upload a version to the AppStoreConnect (needed for Apple's Review/Release) - If you can not run the application in a simulator or via cable connection,
you may hit some compile/run errors especially around cocoapods that require googling, sometimes deleting podfile.lock &
arch -x86_64 pod install --repo-update
works - After successfully running you can modify the run settings and even get a standalone app
to work without the cable using
flutter run --release
.