firebase_ml_vision breaks IOS build, fix for Windows machine - ios

I have a windows machine and would like to build my flutter app for my Iphone. I am using codemagic.com to build my app. With the firebase_ml_vision dependency there is an error when building the app for iOS as seen here, https://github.com/flutter/flutter/issues/28625. I am not sure how to fix this on my windows machine because i am unable to access the iOS build files.
Here is the error message when building the app for iOS
Returning local
[!] CocoaPods could not find compatible versions for pod "firebase_ml_vision":
In Podfile:
firebase_ml_vision (from .symlinks/plugins/firebase_ml_vision/ios)
Specs satisfying the `firebase_ml_vision (from `.symlinks/plugins/firebase_ml_vision/ios`)` dependency were found, but they required a higher minimum deployment target.

If you are using firebase_ml_vision: ^0.10.0 or up, you have to change your Deployment target to 10.0:
In your Podfile: platform :ios, '10.0'
In your Xcode project set iOS Deployment Target to 10.0
Then, run the following in your terminal to build with a fresh state:
flutter clean \
&& rm ios/Podfile.lock pubspec.lock \
&& rm -rf ios/Pods ios/Runner.xcworkspace \
&& flutter build iOS

Related

Error in Xcode 12.5.1 while building, (error spawnSync xcodebuild ENOBUFS)

I was running react-native project in Xcode v12.4, now I shifted my code to v12.5.1. It is giving me above error, when I build my project. What should I do?
I have googled around but not found this error regarding iOS and Xcode.
If you don't have cocoa pods installed you need to by command sudo gem install cocoapods and run following commands from your project main directory
From your project remove Pods and Podfile.lock from ios directory after that re install pods
cd ios && pod install && cd ..
Run your project again

error: could not build Objective-C module 'agora_rtc_engine'

Following up on the repo https://github.com/AgoraIO-Community/Agora-Flutter-Quickstart
Unable to build the project on macOS with the following spec
Flutter 2.2.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision d79295af24 (10 days ago) • 2021-06-11 08:56:01 -0700
Engine • revision 91c9fc8fe0
Tools • Dart 2.13.3
Here is the full error stack
/.../.pub-cache/hosted/pub.dartlang.org/agora_rtc_engine-3.3.3/ios/Classes/Base/AgoraRtcEngineKit.h:9:9: error: 'AgoraRtcKit/AgoraRtcEngineKit.h' file not found
#import <AgoraRtcKit/AgoraRtcEngineKit.h>
^
<unknown>:0: error: could not build Objective-C module 'agora_rtc_engine'
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Constructing build description
note: Build preparation complete
/.../Agora-Flutter-Quickstart/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 14.5.99. (in target
'AgoraRtcEngine_iOS' from project 'Pods')
/.../Agora-Flutter-Quickstart/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 14.5.99. (in target 'Flutter'
from project 'Pods')
I"m not sure if this solution works for others, but this is what worked for me
In here https://github.com/AgoraIO-Community/Agora-Flutter-Quickstart/blob/master/pubspec.yaml#L21:L23
Changed Agora RTC engine version and permission handler to
agora_rtc_engine: ^4.0.1
permission_handler: ^6.0.1
And do the following
Remove ios/Podfile.lock
Remove Pods folder
cd ios > pod install or pod install --repo-update
Remove pubspec.lock
Remove build folder
Run flutter pub get
If this still does not work
rm -rf /YourUserPath/.pub-cache
rm -rf ~/Library/Developer/Xcode/DerivedData
rm ios/Podfile
rm ios/Podfile.lock
rm pubspec.lock
rm -rf ios/Pods
rm -rf ios/Runner.xcworkspace
flutter clean
flutter build ios
flutter clean
flutter run
Try this solution according this:
Quit Xcode.
Delete project's temp files located at
~/Library/Developer/Xcode/DerivedData
Delete ProjectName.xcworkspace
Delete Podfile.lock file and Pods folder
Run pod install.
Open the newly created ProjectName.xcworkspace file and build.

Is there a way to solve the problem I am facing after upgrading firebase in flutter

Hi I am facing an error on flutter while running my application in iOS simulator only. It works perfectly fine in Android simulator. After I upgraded my firebase dependencies that I added since then I am facing the issue.
The version I was using before are as follow
firebase_auth: ^0.18.3
cloud_firestore: ^0.14.3
firebase_core: ^0.5.2
firebase_crashlytics: ^0.2.4
The version I am using now are as follow
firebase_auth: ^0.20.0
cloud_firestore: ^0.16.0
firebase_core: ^0.7.0
firebase_crashlytics: ^0.4.0
The error I am getting is
Error output from CocoaPods:
↳
[!] Automatically assigning platform `iOS` with version `9.0` on target `Runner` because no platform was specified. Please
specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
Error running pod install
Error launching application on iPhone 12.
Note this issue is only in iOS and not on Android and I wanted to upgrade the firebase.
I have tried many methods on Stackoverflow and other resources but it seems to be of no help.
This problem occurs because you have not set a minimum ios version in your Podfile.
Set a platform version in your Podfile.
cd ios
nano Podfile
Uncomment this line at the start of the file
# platform :ios, '9.0'
You can set the version to 11.0 if you like as some plugins don't support 9.0 anymore.
After that is done, run the following commands:
rm Podfile.lock
rm -rf Pods
pod install
Additionally, you can update the minimum iOS version for your app in the Runner to the version you set in the Podfile
That should do it for you.
Delete the 2 pod files in the ios folder. run Flutter clean command in the terminal and then try running the app on your iPhone.
This happens to me often and the above method works for me.
I Have tried multiple stuff and failed on doing this
and now I got the perfect solution for MacBook M1 Chip users.
We need to clear all the cache files and update the pods
following the below steps would be the best
Remove the .Pods and .symlinks in the iOS folder inside the flutter
project.
Remove Podfile.lock Remove pubspec.lock
Run Flutter clean
Run Flutter pub get
Change into iOS folder and run
sudo arch -x86_64 gem install ffi
arch -x86_64 pod update
PS: For M1 Users

Module 'connectivity not found' in iOS build of Flutter application

I have been trying to build my flutter app in iOS simulator but getting build error with following screenshot.
Where my Xcode version is 11.0, CocoaPods version 1.9.3, Flutter version 1.22.0
I have also upgraded connectivity package from 0.4.9+2 to 0.4.9+3 which is latest one. Following some steps by googling but no one is working yet. However my android build is fully ok.
Thanks in advance.
I have solved this issue through running this command in terminal at Project folder directory
rm ios/Podfile && flutter build ios
I solved this problem by setting in the podfile
platform :ios, '12.1'
And then later inserting the same version in Xcode as well
For me, it turned out that I was opening ios/Runner.xcodeproj instead of ios/Runner.xcworkspace.
Opening ios/Runner.xcworkspace from Xcode worked for me!
Alternatively, go to your flutter appname/ios folder and type in commandline:
sudo gem install cocoapods
flutter pub get <---may or may not be necessary for you
pod install
This will install the infuriating cocoapods to your project
If you are working with flavoured build, e.g staging, production, development.
Your app will most likely be running on Runner so click on runner and select the correct build build flavour which in this case would be one of the flavours.
I have this issue and this sequence of steps have worked for me.
Go to the ios folder #cd ios
Delete the Podfile #rm Podfile
Run flutter clean
Run flutter pub get
Case you need generate files with build_runner #flutter packages pub run build_runner build --delete-conflicting-outputs
Build for app for iOS. #flutter build ios
Generate your project pods. #cd ios && pod install
Build project from XCode
In many cases it comes because of difference between Pod install version in flutter and Xcode. Just check them or simply add 'platform :ios, '11.0'' to your podfile in flutter.
rm ios/Podfile && flutter build ios
Change the platform number on Podfile "platform :ios, '12.1" (in XCode: Pick 12.1v.--> Runner > info IOS Deployment Target: 12.1)
Open the flutter ios folder (right-click on ios folder in vs. code and click "Open in Xcode")
Go to Product > Schemes > New Scheme
Select the name of your Cocoapod, then click OK
build again
it's mean som dependencies missing on project. I solved same problem by this step.
cd /YourProject/iOS
rm Podfile
flutter clean On your IDE
flutter pub get
And cd /YourProject/iOS
pod install
in xode clear build and close xcode
and
run this in project folder.
flutter clean && fluttter pub get && cd ios && rm ios/Podfile && cd .. &&flutter build ios
open xcworkspace instead of xcodeproj.
build the project

Xcode Build failed,fatal error: module 'firebase_auth' not found #import firebase_auth;

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.17.4, on Mac OS X 10.15.5 19F101, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.46.1)
[!] Connected device
! No devices available
! Doctor found issues in 1 category.
\\\Error Message
** BUILD FAILED **
Xcode's output:
↳
/Users/Razi/Desktop/projects/Sayy/ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal error: module 'firebase_auth' not found
#import firebase_auth;
~~~~~~~^~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
I have tried deleting Podfile/Podlock and running pod init/ pod install without success. Also have reviewed the GitHub repo for ios folder. Why is firebase_auth not found?
Update: I was able to eventually find a workaround by executing the following:
Running Flutter Clean (in ios folder of project)
Deleting both Podlock & Pod Folder
Running pod init followed by pod install
seems to be an issue with the runner.xcworkspace folder and the build
files needed to run builds.
I tried to follow suggested steps of executing Flutter clean, manually removing podfile and podfile.lock along with Pod related folders, executing pod install again, etc. - nothing helped.
What helped me in the end was the following sequence:
Create a new project with same dependencies declared in the pubspec.yaml.
Run pub get in the new project.
Run pod install in the new project to get everything generated
Copy newly generated podfile and podfile.lock files to the old project.
Run pod install in the old project.
Only after this sequence I was able to build the iOS project again.
These steps helped me to resolve the issue completely for IOS:
>> flutter clean
then "delete podfile, podfile.lock, pod folder"
>> flutter pub get
>> pod install
>> flutter run
It seems like you provided not a full Podfile's content (I can't see anything about Sayy target there) or you've been changing Podfile
Depending on what you trying to archive either remove last 3 lines in Podfile or move line "pod 'AFNetworking', '~> 3.0'" to target 'Runner' right after 'use_modular_headers!'
open XCode toppest item in left sidebar (blue icon) -> in leftest menu you will see two sections — Project and Targets. So names that are in 'targets' block — is the only one that can appear in Podfile after keyword 'target'
everything depends on:
do you need AFNetworking?
what targets do you have in your application
I have got rid of this issue buy un-commenting the line in Podfile
platform :ios, '10.0'
Also delete clean your project and rebuild again!
Change the Deployment target for ios either in build settings-> Deployment in xcode or in podfile set deployment target greater than 10
Here's what worked for me
Find the latest version of firebase_core / firebase_auth on pub.dev
Clear your Pods/ and Podfile.lock in the ios folder
Run pod install --repo-update in the ios folder (IMPORTANT!)
Here are the steps which worked for me:
Delete ios > Pods
Delete ios > Podfile, Podfile.lock
flutter clean
flutter run
After executing these three commands in this order, pod install started, and it was done.

Resources