"directory not found for option '-L/..' " Cocoapods issue - ios

I'm using the CocoaLumberjack library in my Xcode project. I'm running into an issue when updating to the latest (2.2.0) version via pod install. Attaching screen of the error I'm seeing. Error description reads:
ld: warning: directory not found for option '-L/$(PROJECT_DIR)/build/Debug-iphoneos'
Undefined symbols for architecture armv7:
"_ddLogLevel", referenced from:
(Various project files referencing 'ddLogLevel')
armv7 is supported as a valid architecture by my CocoaLumberjack target settings.
Tried the solution here https://stackoverflow.com/a/18618187/3347084 but after doing so I received a different compiler error ld: library not found for -lGoogleAnalyticsServices. Could not fix and decided not to go too far down that rabbit hole unless I'm sure it's necessary to fix my original issue.

Related

XCode 13.1: Undefined symbol: __swift_FORCE_LOAD_$_XCTestSwiftSupport

My app was running perfectly without any errors or warnings yesterday. But when I tried to run it today, the build failed - I haven't changed anything in the code:
Undefined symbol: __swift_FORCE_LOAD_$_XCTestSwiftSupport
How to fix this, and why would something like this occur suddenly when it was working before?
And this is an issue I've been experiencing with XCode a lot lately. My code will be running smoothly without any errors, but then XCode will randomly start throwing errors when I relaunch it at a different time - without making any changes in the actual code.
I have included some photos and the full text of those photos:
InventoryApp 3 issues
Warning
Could not find or use auto-linked library 'XCTestSwiftSupport'
Could not find or use auto linked framework 'XCTest'
Error
Undefined symbol: __swift FORCE LOAD $ XCTestSwiftSupport
ld: warning: Could not find or use auto-linked library 'XCTestSwiftSupport'
ld: warning: Could not find or use auto-linked framework
'XCTest'
Undefined symbols for architecture arm64:
"__swift_FORCE_LOAD_$_XCTestSwiftSupport", referenced from:
__swift_FORCE_LOAD_$_XCTestSwiftSupport_$_inventoryApp in Button.o
__swift_FORCE_LOAD_$_XCTestSwiftSupport_$_inventoryApp in ViewModel.o
__swift_FORCE_LOAD_$_XCTestSwiftSupport_$_inventoryApp in Inventory.o
__swift_FORCE_LOAD_$_XCTestSwiftSupport_$_inventoryApp in AddView.o
__swift_FORCE_LOAD_$_XCTestSwiftSupport_$_inventoryApp in ScannerView.o
__swift_FORCE_LOAD_$_XCTestSwiftSupport_$_inventoryApp in RegisterView.o
__swift_FORCE_LOAD_$_XCTestSwiftSupport_$_inventoryApp in ContentView.o
...
(maybe you meant: __swift_FORCE_LOAD_$_XCTestSwiftSupport_$_inventoryApp)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This condition also occurs if you add
import XCTest
to a file in a non-test bundle.
I solved this error by navigation to target app settings > Build Phases > Link Binary With Libraries > add the linked library "XCTest.framework".
If afterwards your app starts crashing, aborting with the following errors:
dyld: Library not loaded: #rpath/XCTest.framework/Versions/A/XCTest
0_abort_with_payload
Then you can take a look at the suggestions on this thread: Xcode 5.0.2 dyld: Library not loaded: #rpath/XCTest.framework/Versions/A/XCTest
The solution that worked for me was:
Navigate to target app > Build Settings > Linking > Other Linker Flags > editing or adding -weak_framework "XCTest"
This error randomly started to occur on my Xcode project today. I changed the setting.
PROJECT -> Build Settings -> Build Options -> Enable Testing Search Paths
from No to Yes, and the build succeeded.
Edit:...
This setting is on by default if the project is created with a testing target included. In my case I believe I added the testing target later so this setting will have been false. Although, I can't say why it didn't break as soon as I added the testing target.
See:
https://xcodebuildsettings.com
None of the above worked for me. In my case, a couple of mock files were targeted to both the framework and unit testing bundle. I just unticked the framework one to get rid of this error on the inspector.
I solved this error by navigation to target app settings > Build Phases > Link Binary with Libraries > add the linked library "XCTest.framework".
The action above is totally the same as the solutions above, though the issue "Library not loaded" appeared raised.
I solved the "Library not loaded" issue by setting up the framework to be optional while linked library.
[enter image description here][1]
It works for me in Xcode 13.2.1.

Xcode 9 _OBJC_CLASS_$_FBSDKApplicationDelegate

I'm trying to implement Facebook SDK into my project and I get the same issue
Facebook sdk is not a dylib error after update update Xcode 7?
Well, I have Bolts in my Frameworks Directory, also
In my Build Settings:
Frameworks Search Path: ~/Documents/Frameworks/FacebookSDKs-iOS-4.27.0
(That is correct for my path)
In my Briding-Header.h
#import <Bolts/Bolts.h>
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
But, I'm still getting the same error, also, I just deleted the Derived data.
The error is:
ld: warning: Auto-Linking supplied '/Users/jarvis/Documents/Frameworks/FacebookSDKs-iOS-4.27.0/FBSDKCoreKit.framework/FBSDKCoreKit', framework linker option at /Users/jarvis/Documents/Frameworks/FacebookSDKs-iOS-4.27.0/FBSDKCoreKit.framework/FBSDKCoreKit is not a dylib
ld: warning: Auto-Linking supplied '/Users/jarvis/Documents/Frameworks/FacebookSDKs-iOS-4.27.0/Bolts.framework/Bolts', framework linker option at /Users/jarvis/Documents/Frameworks/FacebookSDKs-iOS-4.27.0/Bolts.framework/Bolts is not a dylib
ld: warning: Auto-Linking supplied '/Users/jarvis/Documents/Frameworks/FacebookSDKs-iOS-4.27.0/FBSDKLoginKit.framework/FBSDKLoginKit', framework linker option at /Users/jarvis/Documents/Frameworks/FacebookSDKs-iOS-4.27.0/FBSDKLoginKit.framework/FBSDKLoginKit is not a dylib
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_FBSDKApplicationDelegate", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Some one has an idea about this error?
Well, the solution was weird, basically, I removed the Drag and Drop to my Framework group, and I added the FBSDKCoreKit, FBSDKLoginKit and Bolt using the general settings adding them in Linked Frameworks and Libraries
I also got this error and cleaning the project and building it again 4-5 times worked for me.
Cleaning - Command + Shift + K
Building - Command + B
Another solution is to delete these files in the project folder:enter image description here
pod install
instead of using the method described in FB official reference, I used pods to install them and I easily got rid of this problem

Linking libiconv on ios

I am trying to use the objective-git library for an ios application I am in the proccess of developing. I am able to get the library to compile, link, and run perfectly fine in the simulator. However, when I try to run the application on an actual iPad, I get the followign error:
Undefined symbols for architecture armv7s:
"_libiconv", referenced from:
_git_path_iconv in libObjectiveGit-iOS.a(path.c.o)
"_libiconv_close", referenced from:
_git_path_iconv_clear in libObjectiveGit-iOS.a(path.c.o)
"_libiconv_open", referenced from:
_git_path_iconv_init_precompose in libObjectiveGit-iOS.a(path.c.o)
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I believe the issue is that I am compiling the libgit2 library with a different version of iconv then the one included with ios. However, I have messed with the build script in an attempt to force it to link with the ios version, but the error persists. How should I go about properly linking the iconv library so that I can run the application on an actual device?
You need to add libiconv.tbd to 'Link Binary With Libraries' section in Build Phases.
Note: I know ObjectiveGit fixed this issue but maybe that helps to others those who are trying to use iconv in their projects.

xcode, launching on simulator is ok but cannot archive

I am new to Xcode.
I am adding some features on the old(iOS 3.2) xcode game project. This code never touched for more than a year until I touched.
It worked fine until I tried to make an .iap file. it ran ok and all my changes didn't make any error.
So I changed target device from iPhone 6.0 Simulator -> iOS Device, and tried archive. Unfortunately it generated bunch of errors:
ld: warning: ignoring file lib/libegn_neutron_http_Release_iphoneos.a, file was built for archive which is not the architecture being linked (armv7): lib/libegn_neutron_http_Release_iphoneos.a
Undefined symbols for architecture armv7:
"_EGN_setPollingInMenu", referenced from:
ExitGamesCreateSession(sLibraryData*) in exitgames.o
"_EGN_Neutron_New", referenced from:
ExitGamesInit(sLibraryData*) in exitgames.o
"_EGN_setServerUrl", referenced from:
ExitGamesCreateSession(sLibraryData*) in exitgames.o
......similar 34 errors continued
"_EGN_NeutronCls_Release", referenced from:
ExitGamesShutDown(sLibraryData*) in exitgames.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This project uses some "exitgames" library which supports social features.
Also this project have some wrapping part of "Brew" c++ codes.
I don't know which part has the problem. tried to figure out and searched a whole day but still couldn't get a clue.
Can anybody give me an advice?
Thank you.
Try running lipo -info exitgames.a from the command line, it should tell you what architectures the framework is made to support.

build error while add revmob ad in iOS app

I want to add RevMob add in my app but there are some errors
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_SKStoreProductViewController", referenced from:
objc-class-ref in RevMobAds(RevMobStoreController.o)
"_SKStoreProductParameterITunesItemIdentifier", referenced from:
-[RevMobStoreController openStoreWithITunesItemId:] in RevMobAds(RevMobStoreController.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have added StoreKit,SystemConfiguration and RevMob Frameworks already.
I am using Xcode4.3 and ios4.2
Plz help me.
Thanks in advance.
You need to add the StoreKit framework
EDIT: I see now what you mean, there was an issue with the older versions, I'm adding a link to an edited framework to solve that issue: Edited Revmob Framework
You must link against StoreKit.framework
It looks like the ad sdk you have now does not include support for use with the simulator.
-[RevMobStoreController openStoreWithITunesItemId:] in RevMobAds(RevMobStoreController.o)
ld: symbol(s) not found for architecture i386
if you get anything that mentions "not found for architecture" means revmob didnt include classes for running on simulator. You have 2 choices. look for a missing library ".a file" or only compile for testing on a device.
I've ran into an issue with the new ios6 where revmob did not support the new iphone 5 armv7s architecture.
Double check your revmob installation or try compiling to your phone instead of the simulator
When your are dropping the files manually in xcode the files are not copied to Bundle. So "SKStoreProductViewController.m" was the file not copied in the bundle so the error occurred. To resolve the error. Drag the files only .m files to Copy Bundle Resourceas shown in the image
This error can also happen if you removed a file from your project and subsequently re-created it. Sometimes Xcode doesn't automatically re-include it in the 'compile sources' box (when you click on target).
Check the box and see if all of your source files are included, if not then drag them in and rebuild.
They release a new SDK version (4.6.0) that works perfectly on older Xcode versions!
This also happens with Appirater. I was getting this message:
Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_SKStoreProductViewController", referenced from: objc-class-ref in Appirater.o "_SKStoreProductParameterITunesItemIdentifier", referenced from: +[Appirater rateApp] in Appirater.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
---To Fix---
add StoreKit.framwork in --> BuildPhases
---Under-> Link Libraries with Libraries
If you have more than one target you might need to add the
StoreKit.framwork to both Targets.
I faced similar issue and after long search and checking sample RevMob code, i found this solution, may be help others:
Under project target, select Build Settings, under Deployment, check iOS Deployment Target, change the value to 'iOS 9.0' or higher.
I hope this help.

Resources