ld: warning: directory not found for option '-L/Users/kh/Library/Developer/Xcode/DerivedData/om-euxqzibzllbcmndwqrgthdeotiro/Build/Products/Debug-iphonesimulator/AFNetworking'
ld: warning: directory not found for option '-L/Users/kh/Library/Developer/Xcode/DerivedData/om-euxqzibzllbcmndwqrgthdeotiro/Build/Products/Debug-iphonesimulator/JSONModel'
ld: warning: directory not found for option '-L/Users/kh/Library/Developer/Xcode/DerivedData/om-euxqzibzllbcmndwqrgthdeotiro/Build/Products/Debug-iphonesimulator/ReactiveCocoa'
ld: warning: directory not found for option '-L/Users/kh/Library/Developer/Xcode/DerivedData/om-euxqzibzllbcmndwqrgthdeotiro/Build/Products/Debug-iphonesimulator/Realm'
ld: warning: directory not found for option '-L/Users/kh/Library/Developer/Xcode/DerivedData/dom-euxqzibzllbcmndwqrgthdeotiro/Build/Products/Debug-iphonesimulator/SAMKeychain'
ld: warning: directory not found for option '-L/Users/kh/Library/Developer/Xcode/DerivedData/om-euxqzibzllbcmndwqrgthdeotiro/Build/Products/Debug-iphonesimulator/Sentry'
ld: library not found for -lAFNetworking
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Some Solutions I tried , and all of below didn’t work which was previously suggested on similar stackoverflow questions
- Opening xcworkspace, yes I am opening that.Not the project
- Restart xcode
- Clean & Build multiple times.
- Deleted pods folder, and installed pods again.
- pod update multiple times
- set Build Active architecture Only to Yes
- Selected my Target, went to "Build Phases" in "Link Binary With Libraries" removed ".a" file of that library. Clean and Build.
- Target -> Build Settings ->Other Linker Flags = $(inherited)
- Target -> Build Settings ->Library Search Path = $(inherited)
Note that libPods-om.a is giving me red whenever i add in target ( choose frameworks and libraries to add)
Worth to note, it runs onreal physical device. but not simulator
4
Answers
Please try delete the Derived Data and pod install again
/Library/Developer/Xcode/DerivedData
I had the same issue you are describing. I tried most of the things you mention but none of them worked. In the past I have been 100% successful in running this on the simulator (whenever I was working on a non-UI thing) and needless to say also successful in running it on a real device. Something happened in the last 2 weeks where now neither the simulator nor the real-device can be used.
In the end I just decided to bite the bullet, start from scratch and clone the remote git repository from where the project resides. Note that before doing this I moved my non-working folder into a safe location (Desktop) and cloned the repository into the same location as the non-working used to be.
After that I ran pod install in the folder of the freshly-cloned project and ran it on a physical device. It worked on the first go.
However I still cannot used the simulator. But I’m happy to have gained back the physical device at least.
UPDATE:
SOLUTION FOUND!!
After about a day of researching and trying multiple things. I found a solution here:
https://github.com/CocoaPods/CocoaPods/issues/10059#issuecomment-693346078
Short summary a new entry is added; it is located in Build Settings->User-Defined->VALID-ARCHS. I deleted this, and now I can run both on simulator and on-device.
Go to Build Settings
Add new key under User-Defined section
VALID_ARCHS : armv7 armv7s arm64 arm64e x86_64
I had same issue on Xcode 12.4, only on simulators (on device works well).
Solved by adding
arm64
for keyAny iOS Simulator SDK
onBuild Settings < Excluded Archicetures
. Add onOr, you can try another solution (also worked for me):
arm64
for keyAny iOS Simulator SDK
on Project settingsconfig.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
on Pod file