duplicate symbols for architecture x86_64 ios React Native - ios

I have recently updated to the newer version of Xcode and React Native and I'm having issues with duplicate symbols for my Xcode React Native build. I have tried to remove -ObjC from other Linker flags, changed No Common Blocks to No, and made sure no libraries were linked twice in 'Link Binary with Libraries'. None of those solutions suggested previously have helped; so, any other ideas would be appreciated.

You probably have some third-party libraries that you have added with both pods and react-native link at the same time. Just check your projects Project/Libraries folder and Pods/Products folder to see if there are any duplicates.

Typing the following in a terminal window solved the problem in my case:
cd <project folder>/ios
rm -rf Pods
pod install

I ran into the same issue.
I had to go in "edit scheme" > "builds" > "+" (and add React).
Then you drag and drop React in the list at first position.
Clean & build (successfully, I hope).

I had this issue. The problem for me was that I was using expo v44, and also unimodules which were deprecated and replaced by expo. So, I removed the unimodules package from my package.json, and it was working fine for me. Then, I made sure that I updated my packages which used unimodules, and updated them to a version that uses expo.

Related

No such module 'RxBlocking' in test target

I'm using Carthage for setting up my project's RxSwift dependency. And recently, I tried to use XCFrameworks instead with the command carthage update --platform ios --use-xcframeworks. I've set up all that is needed to be set (eg. changing the .frameworks to .xcframeworks in the Link Binary With Libraries in the targets' Build Phase, etc). It worked and I can run or test in the simulator, until today that is. When I was trying to do the tests this morning, all of a sudden it failed (although it worked fine before) with the error No such module 'RxBlocking'. I've double-checked it and the xcframework has already been built in the Carthage/Build folder, and the xcframework has already been added to the test target's settings.
I've tried all of these but it all failed:
Setting the $(PROJECT_DIR)/Carthage/Build to the Framework Search Paths for the target
Deleting DerivedData/ and/or Carthage/ folders
Resetting the Mac
Can anybody help me to fix this? BTW, I'm on XCode 12.4 and Swift 5. Thanks.
This is actually because of the Apple tools that can't search for the correct Frameworks Search Path. The fix is in this link: https://github.com/ReactiveX/RxSwift/issues/2292#issuecomment-804045119

framework not found RealmSwift

I was installing Realm and imported to my project but when I run the app it shows me an error:
ld: framework not found RealmSwift
clang: error: linker command failed with exit code 1 (use -v to see invocation)
There can be multiple reasons for this issue.
To get the exact issue you can follow the below step :
Right click on error and select 'Reveal in log'. This will give you more insight about the reason of error.
One of the solution is to setting the 'Enabled Bitcode' to No. For this go to Build settings in your target and search 'Bitcode' in the search field.
I have faced this issue multiple times and one of the below solution may work for you.
After installing the pods make sure that you're opening the workspace instead of Xcode project file.
Restart Xcode
Remove derive data for your application
Reintegrate pods using pod deintegrate and pod install for your project
Reset simulator(If you are viewing the output in simulator)
Ensure proper linking of Framework in your project
Restart simulator
Clean project etc.
Hope this may help you.
I was having the same issue.
Initially, I was trying to import the files (Realm.framework and RealmSwift.framework) from download folder but then i was getting the same error like yours.
What i did then, i copied the folder containing the (Realm.framework and RealmSwift.framework) into the project folder and then i imported the files from there. That resolves my issue.
In my case, I've updated the Cocopods to the latest version (1.1.0) via this command sudo gem install cocoapods
is it possible that you are still running the .xcodeproj file. You should run .workspace file in your xcdoe

Auto-Linking framework not found

I have forked a framework called BTNavigationDropdownMenu (swift project for ios). all worked fine till I tried to add a dependency to the latest version in the branch I created. the problem is the same whether I add the other framework (DYBadge) through a podfile or through Carthage.
Auto-Linking framework not found DYBadge.
It seems to have a problem with a UIView extension that is part of DYBadge.
DYBadge works fine in my main app I'm working on (I also need it in the app target).
errors below. thanks for any hints into the right direction.
ld: warning: Auto-Linking framework not found DYBadge Undefined
symbols for architecture x86_64: "(extension in
DYBadge):__ObjC.UIView.getBadge() -> DYBadge.DYBadge?", referenced
from:
Demo.BTNavigationDropdownMenu.updateBadge(text: Swift.String, at: Swift.Int) -> () in BTNavigationDropdownMenu.o ld: symbol(s) not
found for architecture x86_64 clang: error: linker command failed with
exit code 1 (use -v to see invocation)
Xcode is not able to find your frameworks because the FRAMEWORK_SEARCH_PATHS is probably not set or is wrong (happened to me because I moved the Info.plist file).
You can fix this by going into your target and adapt the Build Settings. Simply search in there for FRAMEWORK_SEARCH_PATHS and add the correct one, which is usually $(PROJECT_DIR)/Carthage/Build/iOS (for iOS projects). $(inherited) should also be in there as the first entry.
This is the post of #user3122959 answer in the comments, which helped me and others to fix this problem and was requested to put in as the answer to this question.
Try this process -
Press "Cmd + Shift + K" or shift + cmd + alt + k to clean up, and quit Xcode.
Delete the cache Run "rm -rf ~/Library/Developer/Xcode/DerivedData" in terminal
Open the project and re-build it
I had this problem accessing 3rd party frameworks from my tests. Here's how I fixed it.
In Xcode goto: Your Unit-Test target > Build Phases > Link Binary With Libraries
In Finder goto: Carthage > Build > yourframework.Framework
Drag the framework in to your build phases then clean (cmd - shift - K).
This can also be an error if you use a framework that has Bitcode Enabled on false.
Bitcode Enabled can only be true if all frameworks also have Bitcode enabled true.
Go to your targets build settings and disable bitcode.
For me this fixed it:
Go to Project > Targets > Build Settings (Tab) > Build Options (Heading)
Set Enable Testing Search Paths to Yes.
Instantly back up and running. Honestly not sure what this means but it worked.
If you are using Carthage and several Projects within one Workspace you have to add a symlink to your Main Carthage Folder. it will depend what structure you have, but for example if you have
Project -> Carthage
Project -> Frameworks -> MyImbaFramework than cd in terminal in MyImbaFramework folder and run
ln -s ../../Carthage Carthage
In my case, there was an issue with Bitcode, but Xcode couldn't give an accurate error diagnostic since the project framework references were also somehow messed up. Running the framework tests worked fine, but archiving gave the auto-linking error.
Deleted all framework references from the project, including the Frameworks group they were under, added them back again resolved the references issue, then I got the bitcode issue, which I disabled on the target framework, then and only then, archiving was successful
I had a similar error and none of the suggestions on this page worked. It occurred when trying to create an archive when pointing to my test iPhone, when I changed it to 'Any iOS Device' it worked correctly. I suspect this is related to the recent change to add support for Apple Silicon but I'm not certain how.
Make sure you haven't set a testfile that imports XCTest's TargetMembership to the main target, but to a test target :-)
Hope this helps someone, this is what worked for me
rm -rf ~/Library/Developer/Xcode/DerivedData
rm -rf Pods
rm Podfile.lock
pod cache clean --all
pod install --repo-update
and cleaning the build folder
XCode > Product > Clean Build Folder
or
⌘ Command + ⇧ Shift + K
then closing XCode an clearing the derived data again
rm -rf ~/Library/Developer/Xcode/DerivedData
For me, the problem was that I had set the "Other Linker Flags" setting prior to converting my project to use Cocoapods. To fix this, I changed that field to use $(inhereted) and everything worked after that.

Apple Mach -O Linker (Id) Error?

I am trying to build this xcode workspace which was built from Unity. And after modifying the project a little bit when I getting to the very end of building the project (linking) I get the Apple Mach -O Linker (Id) Error. I can't open the error tab to see what exactly is causing the error. All it says is "Linker command failed with exit code 1 (use -v to see invocation). There are also two Apple Mach -O Linker (Id) Errors which occur but I have no idea how to solve them.
Any help is greatly appreciated!
I can't expand these tabs.. this is all I get told
This is the warning tab expanded, the two Apple Mach -O Linker (Id) warnings are the same
This problem has different solutions , one of them is to set Enable Bitcode to No . ( I don't know why by default it is Yes )
This problem is a ghost like problem . Clearing Cache , Restarting Xcode , Simulator and MAC ,Ensuring proper linking of Frameworks ,Changing app Architecture or , Sometimes just doing nothing can solve this problem .
This issue was connected to "Link Binary With Libraries". I've renamed the target, and there were two .framework files for the Pods. Thus, after removing the outdated one - the issue was solved.
For me the scenario was that I removed one of the dependency in my pods which was not required, after removing it I was getting error that the same dependency not found. So I went to delete its entry from the Project >> Build Settings >> other Linker Flags and then selected the same and deleted it as shown below in the Image. After removing from the linker Flags I started getting the Apple Mach -O Linker (Id) Error? and after trying everything for a day I realised the issue lies inside the linker Flags. Where on deleting any dependecy you have to delete the other line name -framework. you can check the below image to get the clarity.
So I suggest to keep an eye on it while deleting the dependecy from the linker flags, do delete the associated -framework too which lies below the dependency name. In my case it was ObjectMapper
If you just installed/ uninstalled a pod you might want to look at this. Here's what worked for me:
First make sure you are opening the .xcworkspace file not the .xcodeproj. But this is probable not what's causing the issue.
Delete the pod that was recently just installed.
In the project directory on Xcode, open the frameworks folder and if the pod which was just removed is still listed there as one recentlyremovedpod.framework, delete it from there also. This step is what made my project compile eventually.
Another possible cause is if you rename one of your targets (why did I do that?) and you're using pods. You end up with a version of your old target name in the Frameworks folder in your main project (not the Pods project), like pods_oldtarget_framework which no longer exists.
Just delete the old version (or name your target back to it's original and delete the new one), and you should be good to go.
For me it was missing frameworks. Try searching the errors you get on Google and find out which frameworks they're part of, then import them in the Build phases tab.
I was having the same issue, and resolved by
installing the latest CocoaPods
then do pod setup
For me I had the problem because I was using Xcode 9 (beta), then I open the same project with another Xcode 8.3. To solve the problem for me just Clean then Run again.
If building on mac for ios in unity, make sure that in the build settings you disable "Metal Editor Support" under other settings for the ios platform.
I used xcode 9.3 and I got this same error. But with 9.2 it works.
The error may happen because of incompatibilities between the artifacts produced by the two xcodes. The project that threw the error included a framework built with xcode 9.2
I added libstdc++.tbd to "BuildPhases >> Link Binary With Libraries". It works for me.
How I resolved this issue:
I exit Xcode then opened my project's .xcworkspace again.
While Xcode was starting...i saw warnings...xcode is smarter enough and ask you switch to recommended settings...Tap it and let him do the changes.
(Read warning seriously and with positive mind and then you will resolve it) 😊

‘Cordova/CDV.h’ file not found in Xcode 8.2.1

I have one hybrid Cordova project, which is running fine Xcode 5.1.1, but when I am trying to Archive the project in Xcode 8.2.1 with ‘Generic iOS Device’ I am getting the error ‘Cordova/CDV.h’ is not found.
I read many articles about this problem, but none could solve my problem. Most answers are telling to follow the below steps:
"Add this line to your Build Settings -> Header Search Paths:
$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include
"
I have did this but problem not solved, getting another error ‘ld: library not found for -lcrt1.3.1.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)’
Also I have changed the bitcode YES to NO in target Build Settings, but no fruitful result.
Project cordova version 3.4.0 where installed cordova version in machine 6.4.0
Has anybody experience with this kind of problem?
Please, can anyone help? I've been working on this for days.
I got it work by following below steps
In your Xcode project settings select TARGETS
Within TARGETS select the Build Settings tab
In the sub-options under the Build Settings tab be sure to select All
Scroll down to the Search Paths section
Locate Header Search Paths
Add the following configuration to the Release option (as a new value on its own line): $(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include
Clean the project: Command + Shift + K
Restart Xcode
I wanted to report that the response provided by Vinay worked for me. I had to make sure I was in the share extension target, and I added it to the path exactly as suggested above in the Release option, and did not even have to do a clean to get it to regenerate the PCH.
BUT, I was puzzled by this after looking at the setting further and I realized this path was already in the setting. I edited it again, and removed the redundant path, hit 'run' again, and it loaded onto my iPhone and ran fine.
So, I believe that just setting this in the search path forced a recompile on the share extension PCH and all is working again.
I hope this helps others.
I know its too late to answer on this question but still many developers facing the above issue and as per the latest Cordova & ionic version below steps will work in the above error.
As per new update in Cordova some time due to some permission issue or directly run or build iOS platform it's unable to add below file or folders in your iOS project platform :
CordovaLib
so somehow above folder will not add in your project and that's why it's not building your iOS project.
To overcome this issue you need to remove iOS platform from your ionic project and again add it.
Remove iOS platform: sudo ionic cordova platform remove ios
Add it again: sudo ionic cordova platform add ios
By doing this cordova download CordovaLib folder from server and add it into your iOS project and after that users can able to build their project without any error.
recently I faced this issue and I solved by doing the above steps.
Hope this helps others.
Happy coding!
Seems like the "Cordova" folder isn't getting copied into the project during cordova platform add ios
So, you'll have to copy the "Cordova" source folder into your project manually. But you'll have to download the ios source packages from github first, which is located at:
https://github.com/apache/cordova-ios
After downloading the "cordova-ios-master.zip" package and unzipping it, copy the folder named "CordovaLib" into your project next to the Xcode project file:
PROJECT_FOLDER/platforms/ios/PROJECT_NAME
PROJECT_FOLDER/platforms/ios/PROJECT_NAME.xcodeproj
PROJECT_FOLDER/platforms/ios/PROJECT_NAME.xcworkspace
PROJECT_FOLDER/platforms/ios/cordova
PROJECT_FOLDER/platforms/ios/CordovaLib <------- here
PROJECT_FOLDER/platforms/ios/ios.json
PROJECT_FOLDER/platforms/ios/platform_www
PROJECT_FOLDER/platforms/ios/pods-debug.xcconfig
PROJECT_FOLDER/platforms/ios/pods-release.xcconfig
PROJECT_FOLDER/platforms/ios/www

Resources