Flutter: AVCapturePhotoOutput' is only available on iOS 10.0 or newer - ios

Since I upgrade Flutter on the stable channel, I can't run on IOS simulators. This is an error that often appears when updating Flutter, only and despite my research I can't find any solutions. I tried to remove Podfile.lock, update pod and reinstall, change channel and upgrade but always the same error.
Flutter doctor:
[✓] Flutter (Channel stable, v1.17.0, on Mac OS X 10.15.3 19D76, locale en-FR)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.45.0)
[✓] Connected device (3 available)
• No issues found!
Beginning of log:
Xcode build done. 12.3s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
=== BUILD TARGET gRPC-Core OF PROJECT Pods WITH CONFIGURATION Debug ===
/Users/flo/.pub-cache/hosted/pub.dartlang.org/camera-0.4.3+2/ios/Classes/CameraPlugin.m:62:2
4: warning: 'AVCapturePhotoOutput' is only available on iOS 10.0 or newer
[-Wunguarded-availability]
- (void)captureOutput:(AVCapturePhotoOutput *)output
^
In module 'AVFoundation' imported from
/Users/flo/.pub-cache/hosted/pub.dartlang.org/camera-0.4.3+2/ios/Classes/CameraPlugin.m:2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs
/iPhoneSimulator13.2.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVCaptureP
hotoOutput.h:48:12: note: 'AVCapturePhotoOutput' has been marked as being introduced in iOS
10.0 here, but the deployment target is iOS 8.0.0
#interface AVCapturePhotoOutput : AVCaptureOutput

I share the solution that works for those who need it:
rm -rf ios/Podfile ios/Podfile.lock ios/Pods ios/Runner.xcworkspace

Related

Command PhaseScriptExecution failed with a nonzero exit code when flutter run in debug

I have a Flutter project which runs perfectly in v2.3.3. I upgraded the flutter version to 3.0.0 in order to use null safety feature. I solved every errors. However when I ran the project, I got Command PhaseScriptExecution failed with a nonzero exit code error. I couldn't find any reasonable and logical solutions throughout internet. Could you please help me on this issue?
Launching lib/main.dart on iPhone SE (3rd generation) in debug mode...
Running pod install... 5.7s
Running Xcode build...
Xcode build done. 18.1s
Failed to build iOS app
Error output from Xcode build:
↳
2022-05-16 15:32:57.974 xcodebuild[72650:368105] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension
Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-05-16 15:32:57.974 xcodebuild[72650:368105] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension
Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
** BUILD FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/00/r0s0tm0x1s33__6xjw2fml1r0000gn/T/flutter_tools.EYRty2/flutter_ios_build_temp_dir7bCY7C/temporary_xcresult_bundle
ld: warning: linking against a dylib which is not safe for use in application extensions:
/Users/****/Projects/ES.Online.Mobile/build/ios/Debug-iphonesimulator/XCFrameworkIntermediates/InsiderMobileAdvancedNotification/InsiderMobileAdvancedNotification.framework/Ins
iderMobileAdvancedNotification
ld: warning: linking against a dylib which is not safe for use in application extensions:
/Users/****/Projects/ES.Online.Mobile/build/ios/Debug-iphonesimulator/XCFrameworkIntermediates/InsiderMobileAdvancedNotification/InsiderMobileAdvancedNotification.framework/Ins
iderMobileAdvancedNotification
ld: warning: linking against a dylib which is not safe for use in application extensions:
/Users/****/Projects/ES.Online.Mobile/build/ios/Debug-iphonesimulator/XCFrameworkIntermediates/InsiderMobileAdvancedNotification/InsiderMobileAdvancedNotification.framework/Ins
iderMobileAdvancedNotification
ld: warning: linking against a dylib which is not safe for use in application extensions:
/Users/****/Projects/ES.Online.Mobile/build/ios/Debug-iphonesimulator/XCFrameworkIntermediates/InsiderMobileAdvancedNotification/InsiderMobileAdvancedNotification.framework/Ins
iderMobileAdvancedNotification
Failed to package /Users/****/Projects/ES.Online.Mobile.
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
/Users/****/Projects/ES.Online.Mobile/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of
supported deployment target versions is 9.0 to 15.4.99. (in target 'ReachabilitySwift' from project 'Pods')
/Users/****/Projects/ES.Online.Mobile/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of
supported deployment target versions is 9.0 to 15.4.99. (in target 'FMDB' from project 'Pods')
Result bundle written to path:
/var/folders/00/r0s0tm0x1s33__6xjw2fml1r0000gn/T/flutter_tools.EYRty2/flutter_ios_build_temp_dir7bCY7C/temporary_xcresult_bundle
Could not build the application for the simulator.
Error launching application on iPhone SE (3rd generation).
flutter doctor -v output:
[✓] Flutter (Channel stable, 3.0.0, on macOS 12.3.1 21E258 darwin-x64, locale en-TR)
• Flutter version 3.0.0 at /Users/****/Developer/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision ee4e09cce0 (7 days ago), 2022-05-09 16:45:18 -0700
• Engine revision d1b9a6938a
• Dart version 2.17.0
• DevTools version 2.12.2
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/****/Library/Android/sdk
• Platform android-30, build-tools 29.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_202-release-1483-b49-5587405)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.3
[✓] 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 41.1.2
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] VS Code (version 1.67.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.40.0
[✓] Connected device (3 available)
• iPhone SE (3rd generation) (mobile) • 33A8F736-A4EA-41E7-8567-408A051F9952 • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-4 (simulator)
• macOS (desktop) • macos • darwin-x64 • macOS 12.3.1 21E258 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 101.0.4951.64
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
I faced the same issue and resolved it by upgrading a package. Within the spam of warning logs, there was one line that mentioned "Error" instead of "Warning", due to parameter change e.g. in my case for a TextField. I saw the package had an updated version for Flutter 3.0 and reran after upgrading. The warning logs will be still there, but you're app should be running afterwards.
Check for Errors within the Warning Logs thrown by Packages from your pubspec.yaml
I have same issue and I solved in this way:
Update MacOS
Update Xcode and command lines tools
Run flutter pub upgrade, flutter pub get in the project folder
Delete podfile.lock in ios folder of the project
Run cd ios, pod repo update, pod install in the project folder

Flutter iOS project Flutter.h file not found after adding Share Extension

I am stuck with this build issue
ios/Runner/GeneratedPluginRegistrant.h:10:9: error: 'Flutter/Flutter.h' file not found
#import <Flutter/Flutter.h>
^
1 error generated.
:0: error: failed to emit precompiled header
It occurs after carefully adding a Share Extension to the Xcode workspace and configuring it according to this article:
https://medium.com/flutter-community/receive-sharing-files-to-flutter-app-from-another-app-7a84c0c0cd88
The "solutions" appear to be limited to deleting the iOS folder, and then recreating it.
I have done that, however as soon as I then add back in the share extension, I am left with the same problem.
I have so far tried the following, as well as many others since forgotten, and in many different combinations:
flutter clean
delete DerivedData folder
rm Podfile.lock and rm -rf Pods, follow by arch -x86_64 pod install --repo-update
Cocoapods updated
I am running on an M1 Macbook Pro
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.0, on macOS 12.2 21D49 darwin-arm, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.3.1)
[✓] Chrome - develop for the web
[!] Android Studio
✗ Unable to find bundled Java version.
[✓] Android Studio (version 4.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2021.3)
[✓] VS Code (version 1.67.1)
[✓] Connected device (5 available)
[✓] HTTP Host Availability
I have seen the project build and run for the Simulator, but I cannot reliably say what changed or why, and right now it is back to not even building for simulator after I attempted a device build (which failed as above).
Additional notes
My targets (Runner, ShareExtension, Pods) are all set to build for iOS14
ShareExtension has the same bundle id as the Runner project with "Share-Extension" appended.
Bitcode not enabled
Thanks in advance for any help

Error while running flutter project on IOS device

I have been trying to run my flutter project on my MacBook Air 12.1 but getting following error.
Error output from CocoaPods:
↳
Searching for inspections failed: undefined method `map' for nil:NilClass
I have tried cleaning up pods file or deleting pods file and reinstall pods, but facing the same issue since yesterday.
Below is my flutter doctor for the version I am using
[✓] Flutter (Channel stable, 2.8.1, on macOS 12.1 21C52 darwin-x64, locale
en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Android Studio (version 2020.3)
[✓] Connected device (1 available)
If I run the same project on Xcode I am getting a different error as follows:
flutter/.pub-cache/hosted/pub.dartlang.org/share_plus-3.0.4/ios/Classes/FLTSharePlusPlugin.h: No such file or directory
You can run this command in your terminal
sudo arch -x86_64 gem install ffi
and after Re-install dependencies
arch -x86_64 pod install

When building Flutter project from Android Studio it fails, but not from Xcode (after flutter upgrade)

I recently upgraded Flutter framework, and when I try to build and run the project from Android Studio, I get the following warnings and error:
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Running Xcode build...
Xcode build done. 2.2s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
<built-in>:1:10: warning: non-portable path to file '"/Users/<something ...>/ios/Pods/Target Support Files/AppCenter/appcenter-prefix.pch"'; specified path differs in case from file name on disk [-Wnonportable-include-path]
#include "/Users/<something ...>/ios/Pods/Target Support Files/appcenter/appcenter-prefix.pch"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"/Users/<something ...>/ios/Pods/Target Support Files/AppCenter/appcenter-prefix.pch"
1 warning generated.
1 warning and 1 error generated.
error: the following command failed with exit code 0 but produced no further output
CompileC /Users/stefanciprian/Library/Developer/Xcode/DerivedData/Runner-gsbrrhndnahwimaidnqhpsuayzxa/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/appcenter_analytics.build/Objects-normal/x86_64/AppcenterAnalyticsPlugin.o /Users/stefanciprian/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/appcenter_analytics-0.2.1/ios/Classes/AppcenterAnalyticsPlugin.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
note: Using new build system
note: Planning build
note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 11 Pro Max.
If I open the project in Xcode, I get the same warnings, but somehow I manage to build and run successfully on the Simulator.
I tried some suggestions from GitHub Issues regarding paths & symlinks, but they seem to not work.
Also added flutter doctor info:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57, locale en-RO)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
[✓] Android Studio (version 3.5)
[✓] IntelliJ IDEA Ultimate Edition (version 2019.3.1)
[✓] VS Code (version 1.41.1)
[✓] Connected device (1 available)
• No issues found!

Flutter stuck on Building Dart code after doing flutter build ios

I'm trying to build an archive by doing flutter build ios but I encounter a problem on Starting Xcode build
$ flutter build ios
Building com.example.example for the device (ios-release)...
Automatically signing iOS for device deployment using specified
development team in Xcode project: XXXXXX
Running pod install...
Starting Xcode build...
├─Building Dart code...
I already build an archive one (last week) and it was working. Maybe this is due to flutter upgrade ?
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.11.3, on Mac OS X 10.14.1 18B75, locale
en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK
28.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
[✓] Android Studio (version 3.2)
[✓] VS Code (version 1.29.1)
That's an issue that was fixed very recently and the fix should already be available in the master channel.
flutter channel master
flutter doctor
You can also try dev channel, but I'm not sure if it landed there already.
The fix will of course be included in the next beta channel, but a beta release just came out last week, so it will probably take a while to the next.
See also https://github.com/flutter/flutter/issues/24139

Resources