I am new to flutter and trying to realise my first app on iOS however, i am facing this issue and try to resolve it since the past week.
1.After running "flutter build ios", the build and signing is successful
2.The project archive is also a success
(Issue)
But when I click on validate App. I get the below issue, I have spent a lot of time and done a lot of debugging but could not find a reason for this issue.
Screenshot of the error message
terminal output : flutter doctor -v
[✓] Flutter (Channel stable, 1.22.3, on Mac OS X 10.15.7 19H2, locale en-GB)
• Flutter version 1.22.3 at /Users/sohumwahi/Library/flutter
• Framework revision 8874f21 (6 days ago), 2020-10-29 14:14:35 -0700
• Engine revision a1440ca392
• Dart version 2.10.3
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/sohumwahi/Library/Android/sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.1, Build version 12A7403
• CocoaPods version 1.10.0
[!] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6222593)
[✓] VS Code (version 1.50.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.16.0
[✓] Connected device (1 available)
• iPhone 11 Pro (mobile) • 093FA4C3-39F3-4D69-B945-DDD155FDBD49 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-14-1 (simulator)
! Doctor found issues in 1 category.
2
Answers
Here is how you can solve this error:
You must add script to your xcode that will remove the non used code of 3rd party libraries.
When you open your flutter iOS project in xcode you will see in the build phases section that flutter already has a script in place. Do not mess with this script, instead you will add a new one .
Like here is this image:
Then you will have something like this:
After this open the run script and place this code:
if you encounter an error stating that there is a syntax error in the script try removing unrecognized characters that may have been copied while you were trying to copy the script
since xcode does not process them and it happened with me. So copy the code and place in a different code editor that is capable of processing such characters (visual studio for example) and then remove the unwanted characters from the end of certain lines.
So now in total you have two scripts running
After a lot of searches and tries, I found that I have an error in provisioning, and once I solved this I managed to validate the app and upload it to App Store successfully.