Trouble when I try to run Archive command in XCode - objective-c

I'm making an app with Facebook validation. It is working fine on simulator and in the device.
But, when I try to "Archive" (Product => Archive), I get this error:
ld: library not found for -lfacebook_ios_sdk
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The libraries are okay, otherwise it would not compile on simulator/device.
I don't know if this information is relevant, but my project is an ARC project.
Does anyone know what this error could mean?

I solved the problem by just removing the "libfacebook_ios_sdk.a" reference from my Link Binary Libraries and adding it again.
I dont know why it worked, but worked!

Related

ld: library not found for -lopencv_imgproc error

While building my project, I am getting this error.
ld: library not found for -lopencv_imgproc
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What kind of library it is.? Can somebody explain.
Hello friend there are a lot of reason of linkers error. Some basic reason:
1. You can remove linker error goto Build Setting>Build Active Architecture Only set to No for Target and Project both.
2. Sometimes unnecessary .a files created Target>General. Delete irrelevant .a files.
3. Delete all library paths from Build Setting>Search Paths(o top) which you are not using like AFNetworking then pls delete -lAFNetworking path.
Try this if still you got the error show me the screenshot.
Thanks

linker command failed error in case of Twitter+Oauth libraries

i am integrating twitter iOS app with my iOS app just for login purpose and for that i am using SCTwitter and Twitter+OAuth frameworks. but the problem is that when i build my project it gave me a compiler error like below:-
**ld: warning: directory not found for option '-L/Users/harvinder/Desktop/iphone_app 13/Twitter+OAuth/Libraries'
ld: warning: directory not found for option '-L&'
ld: warning: directory not found for option '-LHeaders'
ld: library not found for -lOAuth
clang: error: linker command failed with exit code 1 (use -v to see invocation)**
the above error clearly stated that the Twitter+OAuth library is not found but i have recheck my project and it is added and also i have tried many things like
1. library search paths($(PROJECT_DIR)/Twitter+OAuth/Libraries & Headers)
2.also check Link Binary And Libraries under build phases for libxml2.dylib and libOAuth.a
At last i delete the Twitter+OAuth folder and readded it and then everything works fine but the wired thing is that on the next day when i reopen my project in Xcode ,the same error encounter again and again i delete and readded the Twitter+OAuth folder and everything works fine again and same thing happens on the next day too. so i don't understand this weird behavior.
so please help me on this because everyday i have to delete and readd the folder to run my project.
Spaces are used to separate command line options and the directory with the library contains spaces, so you will need to ensure the command line interpreter doesn't see those spaces. That is generally done using quotes, so try this value in the Library Search Paths:
'$(PROJECT_DIR)/Twitter+OAuth/Libraries & Headers'
^ ^
Alternatively avoid using spaces in directory names.

"ld: library not found for -lPods" only when run in real device

I entered the mysterious phenomenon that I can build my app for simulator but I can't build for real device. The error is as below (which doesn't appear when build for simulator):
ld: library not found for -lPods-TechMoviePlus
clang: error: linker command failed with exit code 1 (use -v to see invocation)
(I'm using Cocoapods and attach one of my app's targets, so that the name of library is a little different.)
Project > Target > General > Linked Frameworks and Libraries is as below:
Thank you for your kindness!
Assigning the target in Podfile has resolved the problem.
target :TechMoviePlus do
pod "AFNetworking", "~> 2.0"
pod "LBGIFImage"
end
Open your pbxproj file with an editor and check for references to Pods-Application. If you renamed your application after pod install, you may have some references to the old pods.
Remove all the references to Pods-Application, launch xcode, full clean, and build.
It worked for me.

Duplicate symbol _OBJC_CLASS_$_Facebook

I'm building an ARC iphone app, and about to integrate the addThis ios library.
I get the following error:
ld: duplicate symbol _OBJC_CLASS_$_Facebook in /Users/mars/Desktop/Pst/trunk/Pst/ThirdPartyLibs/FBConnect/FacebookSDK/FacebookSDK.framework/FacebookSDK(Facebook.o) and /Users/mars/Library/Developer/Xcode/DerivedData/Pst-bqmphjiqldalzsankfvxugsurcdj/Build/Intermediates/Pst.build/Debug-iphonesimulator/Pst.build/Objects-normal/i386/Facebook.o for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've double checked with my Compile Resource, and only 1 facebook.m is present.
I've also put "-fno-objc-arc" in my compiler flags for those library files because they are built without ARC
Any help would be really appreciated!!
I've got the same error when followed the instruction to drag ThirdPartyLibs to my project. It had added both FBConnect and FacebookSDK to my project.
If you open the AddThisDemo project, which comes with the library, you will see that only FacebookSDK and DeprecatedHeaders were added (not entire FBConnect). I have recreated this structure in my project and that had solved my issue.
Hope that helps!
For anyone with this issue but these answers are not helping: if you created one custom class and called it Facebook.h/.m, just change its name and after it, no more linkage errors.
You have a #import "facebook.m" in one of your files where you should have put #import "facebook.h".

TouchJSON Fails on Compile (link error)

Undefined symbols for architecture x86_64:
"_objc_unretainedPointer", referenced from:
-[CJSONScanner scanJSONStringConstant:error:] in CJSONScanner.o
-[CJSONSerializer serializeNumber:error:] in CJSONSerializer.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Hey all. Trying to use TouchJSON to do some JSON-y stuff. I followed the read me for the library to the meter I think, but every time I try to compile I get this error. I don't know much about Xcode (I've only been learning Obj-C recently) so I'm clueless about this. Any ideas?
Try to remove "Experimental" folder (and files inside, of course).
README
Be aware that the code in the Experimental subdirectory of Source is
just that and may not have been extensively tested and/or have extra
dependencies
So it could be a problem about extra dependencies (but always make sure if your project already have linked all dependency libraries/framework)