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

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.

Related

React Native - yarn ios doesn't work after initializing the project

I'm a new user to Mac OS and its system and M1.
After install dependencies of my project and trying yarn iOS
* BUILD FAILED **
The following build commands failed:
CompileC /Users/Library/Developer/Xcode/DerivedData/cemfgnbnzwyxlydpmalbfirprbcu/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RNScreens.build/Objects-normal/arm64/RNSScreenViewEvent.o /Users/Trampo/node_modules/react-native-screens/ios/RNSScreenViewEvent.mm normal arm64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'RNScreens' from project 'Pods')
(1 failure)
For React Native you also have to maintain the ios pod files. So, go to your ios folder and update your pods.
Terminal command:
cd ios/ && pod install --repo-update
I change React Native version to 0.64.4,
run yarn,
cd iOS
pod install
pod update,
Xcode and terminal (iterm2) to running with rosetta.
Work, thanks.

PhaseScriptExecution error in React Native app

Facing this error when I run react-native run-ios after creating the project
Error -
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening BoltAssignment.xcworkspace.
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace BoltAssignment.xcworkspace -configuration Debug -scheme BoltAssignment -destination id=3E598855-6D4F-4F36-BEE1-8663A1F71787
nvm is not compatible with the "PREFIX" environment variable: currently set to "/usr/local"
Run `unset PREFIX` to unset it.
nvm is not compatible with the "PREFIX" environment variable: currently set to "/usr/local"
Run `unset PREFIX` to unset it.
Command PhaseScriptExecution failed with a nonzero exit code
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.4.99. (in target 'Flipper-Glog' from project 'Pods')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.4, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Flipper-PeerTalk' from project 'Pods')
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.4.99. (in target 'libwebp' from project 'Pods')
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.4.99. (in target 'YogaKit' from project 'Pods')
warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the BoltAssignment editor. (in target 'BoltAssignment' from project 'BoltAssignment')
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.4.99. (in target 'Flipper-DoubleConversion' from project 'Pods')
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.4.99. (in target 'boost-for-react-native' from project 'Pods')
warning: no rule to process file '/Users/harsh_nagalla/dev/BoltAssignment/ios/Pods/Flipper-RSocket/rsocket/README.md' of type 'net.daringfireball.markdown' for architecture 'x86_64' (in target 'Flipper-RSocket' from project 'Pods')
warning: no rule to process file '/Users/harsh_nagalla/dev/BoltAssignment/ios/Pods/Flipper-RSocket/rsocket/benchmarks/CMakeLists.txt' of type 'text' for architecture 'x86_64' (in target 'Flipper-RSocket' from project 'Pods')
warning: no rule to process file '/Users/harsh_nagalla/dev/BoltAssignment/ios/Pods/Flipper-RSocket/rsocket/benchmarks/README.md' of type 'net.daringfireball.markdown' for architecture 'x86_64' (in target 'Flipper-RSocket' from project 'Pods')
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.4.99. (in target 'RNFastImage' from project 'Pods')
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.4.99. (in target 'SDWebImageWebPCoder' from project 'Pods')
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/harsh_nagalla/Library/Developer/Xcode/DerivedData/BoltAssignment-cxeqsscopunscndrzxcrfnugkasb/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBReactNativeSpec.build/Script-1F0D93C9412E4439D9C46216EB143B15.sh
(1 failure)
Steps followed-
yarn install
start metro server
cd ios -> pod install
npx react-native run-ios
Pretty new to react native so I am totally clueless why this is happening. It would be much appreciated if someone can help with this.
If you have faced the same issue and still clueless like me then please share and upvote so it reaches to as many people as possible.
I have figured out a solution, if you're using nvm make sure you don't have another globally installed version of Node/npm.
If you aren't sure whether or not you have a global version, go to your bash_profile/zshrc and comment the three nvm initialization lines (export NVM_DIR="$HOME/.nvm" [...]), then open a new terminal and do node --version, if it still finds something it means that you have a global version somewhere, and you can find its path with which node.
In my case I'm using Homebrew, and I had a global version of Node that I wasn't even aware coming from the yarn formula, I discovered it after running brew uses --installed node. I went ahead and uninstalled yarn using brew uninstall --force yarn, which automatically uninstalled its node/npm dependency, then uncommented the nvm initialization lines, and then I reinstalled yarn using nvm's npm with npm i -g yarn, and now everything works.
The only solution that worked for me currently (RN v0.64.0), till this issue root cause properly identified (seems related to nvm though!) is to go to your /node_modules/react-native/scripts/find-node.sh and set these two lines on top.
You can use patch-package to keep those changes permanent.
unset npm_config_prefix
unset PREFIX
I was facing the same error, and I've just run the command suggested in the error:
$ unset PREFIX.
Afterwards the app was building properly.
On Mac, using these two steps, I resolved the issue.
I have removed the old ~/.nvm folder. from-comment
Then I have created via command ln -s $(which node) /usr/local/bin/node (from-answer)
Got same error. Tried lots of fixes, but nothing helped.
I fixed this problem by creating new user on my mac. IOS app began building again in Xcode. I will make some more research what was the reason. I guess its because of bad development environmet setup.
If you explicitly know what version of node you want to run, there's a way to inject it without patch-package (or, one rabbit-hole I went down, sed). The find-node.sh script is actually just updating the PATHs that node is looked for, where generate-specs.sh is actually looking for the node binary...but it allows you to override that with the NODE_BINARY environment variable.
So you could NODE_BINARY=/usr/local/bin/mynode npx react-native run-ios
I had the same issue, the fastest way for it to work (due to some professional issues) was to completely remove NVM and installing Node through brew (macOS)
React Native 0.64 uses the new codegen part and this does not work correctly (yet) when there are spaces in the path of the project. It's a know bug and will be solved in future version, PR already is made
For now you could use a path without a space in it.
Works
/home/wbroek/projectname/
Does not work
/home/wbroek/project name/
It´s a bit of a hack but try this in your podfile:
Ref
post_install do |installer|
installer.pods_project.targets.each do |target|
if (target.name&.eql?('FBReactNativeSpec'))
target.build_phases.each do |build_phase|
if (build_phase.respond_to?(:name) && build_phase.name.eql?('[CP-User] Generate Specs'))
target.build_phases.move(build_phase, 0)
end
end
end
end
I have also faced a similar type of issue. I have find solution on react native github repo.
Removing
export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion from ~/.bash_profile .
AND
Commenting out all the code from project/node_modules/react-native/scripts/find-node.sh
helped to solve this issue.
You can also check original
https://github.com/facebook/react-native/issues/31249#issuecomment-811715288
I had this problem while my which node was pointing to /usr/local/bin/node
Solved it by
Installing nvm from curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
nvm use 16
cd ios/ Delete podfile.lock and Pods/
pod instal
I had a same problem and could solve it as following steps.
{your project} > ios > Podfile
Change from "false" to "true" at the "hermes_enabled" setting.
:hermes_enabled => true
cd ios && pod install
npx react-native run-ios
I solved this problem using npx react-native run-ios instead of yarn ios.
Maybe can help u .
Yeah, had the same issue, didn't realize it was a new RN version first. Downgraded to 0.63.4 and it works as it should:
yarn upgrade react-native#0.63

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.

firebase_ml_vision breaks IOS build, fix for Windows machine

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

Resources