Build for iOS fails in Xcode 11 - ios

I change my iOS SDK to 14.0 from 13.4 then I try to build for ios but it fails when I try to build using 13.4. It doesn't show an error but I cannot upload the app it says error on the picture so needs to upgrade my SDK.
Here is my flutter --verbose:
[✓] Flutter (Channel stable, 2.0.5, on Mac OS X 10.15.3 19D76 darwin-x64, locale en-US)
• Flutter version 2.0.5 at /Users/fee/Documents/Developer/flutter
• Framework revision adc687823a (2 weeks ago), 2021-04-16 09:40:20 -0700
• Engine revision b09f014e96
• Dart version 2.12.3
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/fee/Library/Android/sdk
• Platform android-30, build-tools 28.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.
[!] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.4.1, Build version 11E503a
! Xcode 11.4.1 out of date (12.0.1 is recommended).
Download the latest version or update via the Mac App Store.
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 44.0.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] Connected device (2 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 90.0.4430.93
And, here is the error shown
Error output from Xcode build:
2021-04-30 13:05:34.432 XCBBuildService[28375:199855] /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk: error: SDK 'iphoneos14.0'
already registered from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
2021-04-30 13:05:34.610 XCBBuildService[28375:199855] /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk: error: SDK 'iphoneos14.0'
already registered from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
2021-04-30 13:05:34.840 XCBBuildService[28375:199855] /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk: error: SDK 'iphoneos14.0'
already registered from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
** BUILD FAILED **
Xcode's output:
↳
note: Using new build system
note: Building targets in parallel
error: unknown error while handling message: unableToInitializeCore(errors: ["/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk:
error: SDK \'iphoneos14.0\' already registered from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk"])
I want your help to find where is this error comes from.

Your flutter doctor basically mentioned the problem for you:
Xcode 11.4.1 out of date (12.0.1 is recommended).
while Xcode 12 is required to build and upload to App Store. Update Xcode and try building again.

Related

Invalid Binary issue in flutter IOS build

So, yesterday I build an app for ios, archive it and upload it to AppStore connect through xcode, everything seemed good but after few moments I received an email from apple saying:
Dear Developer,
We identified one or more issues with a recent delivery for your app, "APP-NAME" 1.0.1 (2). Please correct the following issues, then upload again.
ITMS-90755: Invalid Binary - The following binaries in your app contains prohibited instructions: /Volumes/data01/app_data/awf/SWImportWorker-mr47p00ce-swpr0068.cse.apple.com-300252/ff03-SoftwareImportWorker-MR_.0/NYH74E2GDJSTMWPVXUPB4IZWH4/umuagyjihbsjsrpn/wspvjpsuvltmmknh/Payload/Runner.app/Frameworks/App.framework/App. Remove the instructions from the binaries, rebuild and resubmit.
Best regards,
The App Store Team
I tried again with flutter clean and also increased the IOS deployment target but it didn't help.
My device's Flutter info:
Flutter (Channel stable, 2.5.0, on macOS 11.5.2 20G95 darwin-x64, locale
en-PK)
• Flutter version 2.5.0 at /Users/niteshkongreja/Development/flutter
• Upstream repository https://github.com/niteshcongreja321/flutter.git
• Framework revision 4cc385b4b8 (10 days ago), 2021-09-07 23:01:49 -0700
• Engine revision f0826da7ef
• Dart version 2.14.0
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/niteshkongreja/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• ANDROID_HOME = /Users/niteshkongreja/Library/Android/sdk
• Java binary at: /Applications/Android
Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5.1, Build version 12E507
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)
[✓] VS Code (version 1.60.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.26.0
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-x64 • macOS 11.5.2 20G95 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 93.0.4577.82
• No issues found!
All I had to do was revoke my certificate, delete the mobileprovision file, then recreate both.
I also changed over to Air SDK 3.7.0.1530 and included the Default-568h#2x.png for the iphone splash screen, and well... it seems to have worked.

iOS flutter app not running after updating device to iOS 14.7.1

After updating my iPhone 11 to iOS version 14.7.1, my flutter app is not launching anymore.
Steps already performed:
flutter clean
flutter pub get
flutter run
Also,
uninstalled and reinstalled the app
restarted the phone
output:
(base) Henrys-MacBook-Air:flutter henrycorreia$ flutter run
Running "flutter pub get" in flutter... 3.2s
Launching lib/main.dart on Henry’s iPhone in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: XXXXXXXXXX
Running pod install... 25.0s
Running Xcode build...
Xcode build done. 208.8s
Installing and launching... 58.4s
Error launching application on Henry’s iPhone.
==>> flutter doctor -v:
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.5.1 20G80 darwin-x64, locale en-GB)
• Flutter version 2.2.3 at /Users/henrycorreia/fvm/versions/2.2.3
• Framework revision f4abaa0735 (6 weeks ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/henr/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 11.0.8+10-b944.6916264)
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5.1, Build version 12E507
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
[✓] VS Code (version 1.59.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.25.0
[✓] Connected device (3 available)
• Moto E 4 Plus (mobile) • xxxxxxxxx • android-arm • Android 7.1.1 (API 25)
• Henry’s iPhone (mobile) • xxxxxxxxxxxxxx • ios • iOS 14.7.1
• Chrome (web) • chrome • web-javascript • Google Chrome 92.0.4515.131
! Doctor found issues in 1 category.
Is anybody facing the same issue? Any idea how to fix this?
Thank you
You have runtime error just before your first screen renders, try putting breakpoint in the first line of the main and debug line by line.
I was able to fix the issue. It seems to be a random issue that happens time to time when updating either the flutter version or iOS...
Here's how I fixed the issue:
==>> you can also get inspired by this thread: https://github.com/flutter/flutter/issues/72161
However, what worked for me was very simple as I am using vs code:
uninstalled the app
restarted the phone
open the app using Xcode
Product -> Clean Build Folder
Product -> Run
The app will launch correctly, then quit Xcode
After that, I run the app using vs code, and now it works as before.

Failed to launch iOS Simulator: Error: Emulator didn't connect within 60 seconds

Flutter doctor -v(same result with and without ios simulator running)
flutter doctor -v
[✓] Flutter (Channel stable, 2.2.3, on Mac OS X 10.14.6 18G103 darwin-x64, locale en-US)
• Flutter version 2.2.3 at /Users/faizan/Developer/flutter
• Framework revision f4abaa0735 (8 weeks ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/faizan/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• ANDROID_HOME = /Users/faizan/Library/Android/sdk
• Java binary at: /Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/bin/java
• Java version Java(TM) SE Runtime Environment (build 1.8.0_301-b09)
• All Android licenses accepted.
[!] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.1, Build version 10B61
✗ Xcode 10.1.0 out of date (12.0.1 is recommended).
Download the latest version or update via the Mac App Store.
• CocoaPods version 1.10.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[!] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
✗ Unable to find bundled Java version.
• Try updating or re-installing Android Studio.
[✓] VS Code (version 1.59.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.25.0
[✓] Connected device (2 available)
• macOS (desktop) • macos • darwin-x64 • Mac OS X 10.14.6 18G103 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 92.0.4515.159
! Doctor found issues in 2 categories.
No devices in bottom tab of vscode even i started the ios simulator. Same happens with android studio
I tried both 12.0.1 xcode and 10.1 with and without command line tools
Go to your system activity monitor, search for simulator, double click on it, then quit ==> then fore quit.
It should work afterwards. Don't know why it happens, but it's not the first time, happens on and off.

flutter run error Command PhaseScriptExecution failed with a nonzero exit code but works with Xcode

whenever I'm trying to run flutter using VScode I get this error
** BUILD FAILED **
Xcode's output:
↳
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Constructing build description
note: Build preparation complete
Could not build the application for the simulator.
Error launching application on iPhone 12.
but it builds and runs with Xcode successfully.
my flutter doctor
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.4 20F71 darwin-x64, locale
en-SA)
• Flutter version 2.2.3 at /Users/MJ/Development/Tools/flutter
• Framework revision f4abaa0735 (8 days ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
• Android SDK at /Users/MJ/Library/Android/sdk
• Platform android-30, build-tools 30.0.1
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5.1, Build version 12E507
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
[✓] VS Code (version 1.58.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.24.0
[✓] Connected device (4 available)
• MJs iPhone (mobile) • 00008101-0016114C3E10001E • ios
• iOS 14.6
• iPhone 12 (mobile) • E504D08A-A8D9-443E-AD19-D91C0EBFD823 • ios
• com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
• macOS (desktop) • macos • darwin-x64
• macOS 11.4 20F71 darwin-x64
• Chrome (web) • chrome •
web-javascript • Google Chrome 91.0.4472.114
• No issues found!
I have tried deleting podfile and podfile.lock, tried flutter clean and flutter build iOS and flutter run all giving me the same error. but when I'm running or building with Xcode it builds fine with no errors.
please help it's been three weeks now reading the whole internet with now luck.

callback_cache.cc(132) Could not parse callback cache, aborting restore - [Flutter]

I am trying to run Flutter application after my latest flutter upgrade.
It shows below error
Runner[58802:2599379] [VERBOSE-1:callback_cache.cc(132)] Could not parse callback cache, aborting restore
Application shuts after native Splash screen.
In Android platform it works but when trying to run debug app to iOS simulator it gives above error
Flutter LOG
[✓] Flutter (Channel master, 1.18.0-10.0.pre, on Mac OS X 10.15.4 19E287, locale
en-GB)
• Flutter version 1.18.0-10.0.pre at /Users/harshbhavsar/flutter
• Framework revision a58d50deb1 (3 weeks ago), 2020-04-29 13:04:59 -0700
• Engine revision 2db3276573
• Dart version 2.9.0 (build 2.9.0-3.0.dev 726d3c7725)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
• Android SDK at /Users/harshbhavsar/Library/Android/sdk
• Platform android-29, build-tools 29.0.1
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.4.1, Build version 11E503a
• CocoaPods version 1.9.1

Resources